build: avoid runtime wildcard import in global build
This commit is contained in:
1
packages/global.d.ts
vendored
1
packages/global.d.ts
vendored
@@ -4,6 +4,7 @@ declare var __TEST__: boolean
|
||||
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
|
||||
|
||||
@@ -58,7 +58,13 @@ function compileToFunction(
|
||||
...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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user