fix(compiler): bail strigification on runtime constant expressions
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -86,11 +86,14 @@ export const transformSrcset: NodeTransform = (node, context) => {
|
||||
}
|
||||
})
|
||||
|
||||
const hoisted = context.hoist(compoundExpression)
|
||||
hoisted.isRuntimeConstant = true
|
||||
|
||||
node.props[index] = {
|
||||
type: NodeTypes.DIRECTIVE,
|
||||
name: 'bind',
|
||||
arg: createSimpleExpression('srcset', true, attr.loc),
|
||||
exp: context.hoist(compoundExpression),
|
||||
exp: hoisted,
|
||||
modifiers: [],
|
||||
loc: attr.loc
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user