fix(compiler-dom): should bail stringification on runtime constant regardless of position

ref: vuejs/vite#157
This commit is contained in:
Evan You
2020-05-18 10:04:03 -04:00
parent 45c96a06aa
commit dd2bfb5a8f
4 changed files with 99 additions and 49 deletions

View File

@@ -185,17 +185,6 @@ function analyzeNode(node: StringiableNode): [number, number] | false {
) {
return bail()
}
// some transforms, e.g. `transformAssetUrls` in `@vue/compiler-sfc` may
// convert static attributes into a v-bind with a constnat expresion.
// Such constant bindings are eligible for hoisting but not for static
// stringification because they cannot be pre-evaluated.
if (
p.exp &&
(p.exp.type === NodeTypes.COMPOUND_EXPRESSION ||
p.exp.isRuntimeConstant)
) {
return bail()
}
}
}
for (let i = 0; i < node.children.length; i++) {