__BROWSER__: false,
__BUNDLER__: true,
__RUNTIME_COMPILE__: true,
+ __GLOBAL__: false,
__NODE_JS__: true,
__FEATURE_OPTIONS__: true,
__FEATURE_SUSPENSE__: true
declare var __BROWSER__: boolean
declare var __BUNDLER__: boolean
declare var __RUNTIME_COMPILE__: boolean
+declare var __GLOBAL__: boolean
declare var __NODE_JS__: boolean
declare var __COMMIT__: string
declare var __VERSION__: string
...options
})
- const render = new Function('Vue', code)(runtimeDom) as RenderFunction
+ // The wildcard import results in a huge object with every export
+ // with keys that cannot be mangled, and can be quite heavy size-wise.
+ // In the global build we know `Vue` is available globally so we can avoid
+ // the wildcard object.
+ const render = (__GLOBAL__
+ ? new Function(code)()
+ : new Function('Vue', code)(runtimeDom)) as RenderFunction
return (compileCache[key] = render)
}
(isGlobalBuild || isRawESMBuild || isBundlerESMBuild) &&
!packageOptions.enableNonBrowserBranches,
isRuntimeCompileBuild,
+ isGlobalBuild,
isNodeBuild
),
...plugins
isBundlerESMBuild,
isBrowserBuild,
isRuntimeCompileBuild,
+ isGlobalBuild,
isNodeBuild
) {
const replacements = {
__BUNDLER__: isBundlerESMBuild,
// support compile in browser?
__RUNTIME_COMPILE__: isRuntimeCompileBuild,
+ __GLOBAL__: isGlobalBuild,
// is targeting Node (SSR)?
__NODE_JS__: isNodeBuild,
// support options?