chore: fix browser build treeshaking for transformExpression
This commit is contained in:
parent
84909648e7
commit
642a44f8f0
@ -17,7 +17,7 @@ export function compile(
|
|||||||
template: string | RootNode,
|
template: string | RootNode,
|
||||||
options: CompilerOptions = {}
|
options: CompilerOptions = {}
|
||||||
): CodegenResult {
|
): CodegenResult {
|
||||||
if (__BROWSER__ && options.prefixIdentifiers) {
|
if (__BROWSER__ && options.prefixIdentifiers === false) {
|
||||||
;(options.onError || defaultOnError)(
|
;(options.onError || defaultOnError)(
|
||||||
createCompilerError(ErrorCodes.X_PREFIX_ID_NOT_SUPPORTED)
|
createCompilerError(ErrorCodes.X_PREFIX_ID_NOT_SUPPORTED)
|
||||||
)
|
)
|
||||||
@ -25,13 +25,14 @@ export function compile(
|
|||||||
|
|
||||||
const ast = isString(template) ? parse(template, options) : template
|
const ast = isString(template) ? parse(template, options) : template
|
||||||
|
|
||||||
|
const prefixIdentifiers = !__BROWSER__ && options.prefixIdentifiers === true
|
||||||
transform(ast, {
|
transform(ast, {
|
||||||
...options,
|
...options,
|
||||||
prefixIdentifiers: !__BROWSER__ && options.prefixIdentifiers === true,
|
prefixIdentifiers,
|
||||||
nodeTransforms: [
|
nodeTransforms: [
|
||||||
transformIf,
|
transformIf,
|
||||||
transformFor,
|
transformFor,
|
||||||
transformExpression,
|
...(prefixIdentifiers ? [transformExpression] : []),
|
||||||
transformElement,
|
transformElement,
|
||||||
...(options.nodeTransforms || []) // user transforms
|
...(options.nodeTransforms || []) // user transforms
|
||||||
],
|
],
|
||||||
@ -41,6 +42,7 @@ export function compile(
|
|||||||
...(options.directiveTransforms || {}) // user transforms
|
...(options.directiveTransforms || {}) // user transforms
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return generate(ast, options)
|
return generate(ast, options)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user