cjs.js — vite Source File
Architecture documentation for cjs.js, a javascript file in the vite codebase. 7 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 0aa318ec_4292_3c88_8fca_2f5fb2abe37a["cjs.js"] 16c08f9f_8e90_777b_a0bf_1b3f40a90ecd["react"] 0aa318ec_4292_3c88_8fca_2f5fb2abe37a --> 16c08f9f_8e90_777b_a0bf_1b3f40a90ecd a854999e_8562_a55d_d67e_8ef1b0b766cf["client"] 0aa318ec_4292_3c88_8fca_2f5fb2abe37a --> a854999e_8562_a55d_d67e_8ef1b0b766cf 5939fe17_b9d3_0885_7677_a9978cf69f06["phoenix"] 0aa318ec_4292_3c88_8fca_2f5fb2abe37a --> 5939fe17_b9d3_0885_7677_a9978cf69f06 9c6ce808_901d_05f2_bd76_08b10cfa3aa0["clipboard"] 0aa318ec_4292_3c88_8fca_2f5fb2abe37a --> 9c6ce808_901d_05f2_bd76_08b10cfa3aa0 24286e4f_9adf_2bee_537c_d336b5d2de0b["test-dep-cjs-with-es-module-flag"] 0aa318ec_4292_3c88_8fca_2f5fb2abe37a --> 24286e4f_9adf_2bee_537c_d336b5d2de0b 7f68bd32_3651_9601_3039_77a1f75d8525["test-dep-cjs-compiled-from-esm"] 0aa318ec_4292_3c88_8fca_2f5fb2abe37a --> 7f68bd32_3651_9601_3039_77a1f75d8525 2dde1aa6_cd94_7307_97f5_a9a6e84f2d5c["test-dep-cjs-compiled-from-cjs"] 0aa318ec_4292_3c88_8fca_2f5fb2abe37a --> 2dde1aa6_cd94_7307_97f5_a9a6e84f2d5c style 0aa318ec_4292_3c88_8fca_2f5fb2abe37a fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
// test importing both default and named exports from a CommonJS module
// React is the ultimate test of this because its dynamic exports assignments
// are not statically detectable by @rollup/plugin-commonjs.
import React, { useState } from 'react'
import ReactDOM from 'react-dom/client'
import { Socket } from 'phoenix'
import clip from 'clipboard'
import m from '@vitejs/test-dep-cjs-with-es-module-flag'
import cjsFromESM from '@vitejs/test-dep-cjs-compiled-from-esm'
import cjsFromCJS from '@vitejs/test-dep-cjs-compiled-from-cjs'
import * as cjsFromCJSNamespace from '@vitejs/test-dep-cjs-compiled-from-cjs'
// Test exporting a name that was already imported
export { useState } from 'react'
export { useState as anotherNameForUseState } from 'react'
export { default as React } from 'react'
if (typeof clip === 'function') {
text('.cjs-clipboard', 'ok')
}
if (typeof Socket === 'function') {
text('.cjs-phoenix', 'ok')
}
text('.cjs-with-es-module-flag', m.info)
if (typeof cjsFromESM.default === 'function') {
text('.cjs-dep-cjs-compiled-from-esm', 'ok')
}
if (
typeof cjsFromCJS === 'function' &&
typeof cjsFromCJSNamespace !== 'function' &&
cjsFromCJSNamespace.bar === 'bar'
) {
text('.cjs-dep-cjs-compiled-from-cjs', 'ok')
}
function App() {
const [count, setCount] = useState(0)
return React.createElement(
'button',
{
onClick() {
setCount(count + 1)
},
},
`count is ${count}`,
)
}
ReactDOM.createRoot(document.querySelector('.cjs')).render(
React.createElement(App),
)
function text(el, text) {
document.querySelector(el).textContent = text
}
Domain
Subdomains
Dependencies
- client
- clipboard
- phoenix
- react
- test-dep-cjs-compiled-from-cjs
- test-dep-cjs-compiled-from-esm
- test-dep-cjs-with-es-module-flag
Source
Frequently Asked Questions
What does cjs.js do?
cjs.js is a source file in the vite codebase, written in javascript. It belongs to the ViteCore domain, DevServer subdomain.
What functions are defined in cjs.js?
cjs.js defines 2 function(s): App, text.
What does cjs.js depend on?
cjs.js imports 7 module(s): client, clipboard, phoenix, react, test-dep-cjs-compiled-from-cjs, test-dep-cjs-compiled-from-esm, test-dep-cjs-with-es-module-flag.
Where is cjs.js in the architecture?
cjs.js is located at playground/optimize-deps/cjs.js (domain: ViteCore, subdomain: DevServer, directory: playground/optimize-deps).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free