fix(compiler): bail strigification on runtime constant expressions

This commit is contained in:
Evan You
2020-05-04 15:15:26 -04:00
parent 3c3fe88c64
commit f9a3766fd6
5 changed files with 80 additions and 3 deletions

View File

@@ -126,11 +126,14 @@ function getImportsExpressionExp(
}
const name = `_imports_${importsArray.length}`
const exp = createSimpleExpression(name, false, loc, true)
exp.isRuntimeConstant = true
context.imports.add({ exp, path })
if (hash && path) {
return context.hoist(
const ret = context.hoist(
createSimpleExpression(`${name} + '${hash}'`, false, loc, true)
)
ret.isRuntimeConstant = true
return ret
} else {
return exp
}