resolved = resolveExt(filename, fs)
} else {
// module or aliased import - use full TS resolution, only supported in Node
- if (!__NODE_JS__) {
+ if (!__CJS__) {
return ctx.error(
`Type import from non-relative sources is not supported in the browser build.`,
node,
ts: typeof TS,
fs: FS,
): string | undefined {
- if (!__NODE_JS__) return
+ if (!__CJS__) return
// 1. resolve tsconfig.json
const configPath = ts.findConfigFile(containingFile, fs.fileExists)
declare var __GLOBAL__: boolean
declare var __ESM_BUNDLER__: boolean
declare var __ESM_BROWSER__: boolean
-declare var __NODE_JS__: boolean
+declare var __CJS__: boolean
declare var __SSR__: boolean
declare var __COMMIT__: string
declare var __VERSION__: string
* @internal
*/
export const ErrorTypeStrings = (
- __ESM_BUNDLER__ || __NODE_JS__ || __DEV__ ? _ErrorTypeStrings : null
+ __ESM_BUNDLER__ || __CJS__ || __DEV__ ? _ErrorTypeStrings : null
) as typeof _ErrorTypeStrings
// For devtools
instance: ComponentInternalInstance,
): SSRRenderFunction {
// TODO: this branch should now work in ESM builds, enable it in a minor
- if (!__NODE_JS__) {
+ if (!__CJS__) {
throw new Error(
`On-the-fly template compilation is not supported in the ESM build of ` +
`@vue/server-renderer. All templates must be pre-compiled into ` +
input: App | VNode,
context: SSRContext = {},
): Readable {
- const stream: Readable = __NODE_JS__
+ const stream: Readable = __CJS__
? new (require('node:stream').Readable)({ read() {} })
: null
const isBundlerESMBuild = /esm-bundler/.test(format)
const isBrowserESMBuild = /esm-browser/.test(format)
const isServerRenderer = name === 'server-renderer'
- const isNodeBuild = format === 'cjs'
+ const isCJSBuild = format === 'cjs'
const isGlobalBuild = /global/.test(format)
const isCompatPackage =
pkg.name === '@vue/compat' || pkg.name === '@vue/compat-canary'
**/`
output.exports = isCompatPackage ? 'auto' : 'named'
- if (isNodeBuild) {
+ if (isCJSBuild) {
output.esModule = true
}
output.sourcemap = !!process.env.SOURCE_MAP
__ESM_BUNDLER__: String(isBundlerESMBuild),
__ESM_BROWSER__: String(isBrowserESMBuild),
// is targeting Node (SSR)?
- __NODE_JS__: String(isNodeBuild),
+ __CJS__: String(isCJSBuild),
// need SSR-specific branches?
- __SSR__: String(isNodeBuild || isBundlerESMBuild || isServerRenderer),
+ __SSR__: String(isCJSBuild || isBundlerESMBuild || isServerRenderer),
// 2.x compat build
__COMPAT__: String(isCompatBuild),
tsconfig: path.resolve(__dirname, 'tsconfig.json'),
sourceMap: output.sourcemap,
minify: false,
- target: isServerRenderer || isNodeBuild ? 'es2019' : 'es2015',
+ target: isServerRenderer || isCJSBuild ? 'es2019' : 'es2015',
define: resolveDefine(),
}),
...resolveNodePlugins(),
__GLOBAL__: String(format === 'global'),
__ESM_BUNDLER__: String(format.includes('esm-bundler')),
__ESM_BROWSER__: String(format.includes('esm-browser')),
- __NODE_JS__: String(format === 'cjs'),
+ __CJS__: String(format === 'cjs'),
__SSR__: String(format === 'cjs' || format.includes('esm-bundler')),
__COMPAT__: String(target === 'vue-compat'),
__FEATURE_SUSPENSE__: `true`,
__GLOBAL__: false,
__ESM_BUNDLER__: true,
__ESM_BROWSER__: false,
- __NODE_JS__: true,
+ __CJS__: true,
__SSR__: true,
__FEATURE_OPTIONS_API__: true,
__FEATURE_SUSPENSE__: true,