}"
`;
-exports[`compiler: codegen module mode preamble w/ optimizeBindings: true 1`] = `
+exports[`compiler: codegen module mode preamble w/ optimizeImports: true 1`] = `
"import { createVNode, resolveDirective } from \\"vue\\"
// Binding optimization for webpack code-split
expect(code).toMatchSnapshot()
})
- test('module mode preamble w/ optimizeBindings: true', () => {
+ test('module mode preamble w/ optimizeImports: true', () => {
const root = createRoot({
helpers: [CREATE_VNODE, RESOLVE_DIRECTIVE]
})
- const { code } = generate(root, { mode: 'module', optimizeBindings: true })
+ const { code } = generate(root, { mode: 'module', optimizeImports: true })
expect(code).toMatch(
`import { ${helperNameMap[CREATE_VNODE]}, ${
helperNameMap[RESOLVE_DIRECTIVE]
sourceMap = false,
filename = `template.vue.html`,
scopeId = null,
- optimizeBindings = false,
+ optimizeImports = false,
runtimeGlobalName = `Vue`,
runtimeModuleName = `vue`,
ssr = false
sourceMap,
filename,
scopeId,
- optimizeBindings,
+ optimizeImports,
runtimeGlobalName,
runtimeModuleName,
ssr,
helper,
newline,
scopeId,
- optimizeBindings,
+ optimizeImports,
runtimeModuleName
} = context
// generate import statements for helpers
if (ast.helpers.length) {
- if (optimizeBindings) {
+ if (optimizeImports) {
// when bundled with webpack with code-split, calling an import binding
// as a function leads to it being wrapped with `Object(a.b)` or `(0,a.b)`,
// incurring both payload size increase and potential perf overhead.
* (only used for webpack code-split)
* @default false
*/
- optimizeBindings?: boolean
+ optimizeImports?: boolean
/**
* Customize where to import runtime helpers from.
* @default 'vue'
export const compilerOptions: CompilerOptions = reactive({
mode: 'module',
prefixIdentifiers: false,
- optimizeBindings: false,
+ optimizeImports: false,
hoistStatic: false,
cacheHandlers: false,
scopeId: null
h('label', { for: 'scope-id' }, 'scopeId')
]),
- // toggle optimizeBindings
+ // toggle optimizeImports
h('li', [
h('input', {
type: 'checkbox',
- id: 'optimize-bindings',
+ id: 'optimize-imports',
disabled: !isModule || isSSR,
- checked: isModule && !isSSR && compilerOptions.optimizeBindings,
+ checked: isModule && !isSSR && compilerOptions.optimizeImports,
onChange(e: Event) {
- compilerOptions.optimizeBindings = (e.target as HTMLInputElement).checked
+ compilerOptions.optimizeImports = (e.target as HTMLInputElement).checked
}
}),
- h('label', { for: 'optimize-bindings' }, 'optimizeBindings')
+ h('label', { for: 'optimize-imports' }, 'optimizeImports')
])
])
])