wip(compiler): tweak codegen, avoid duplicated asset resolution, improve formatting

This commit is contained in:
Evan You
2019-09-27 22:49:20 -04:00
parent 32666c7708
commit 262be6733c
3 changed files with 18 additions and 8 deletions

View File

@@ -46,7 +46,7 @@ export const transformElement: NodeTransform = (node, context) => {
if (isComponent) {
componentIdentifier = `_component_${toValidId(node.tag)}`
context.statements.push(
context.statements.add(
`const ${componentIdentifier} = ${context.helper(
RESOLVE_COMPONENT
)}(${JSON.stringify(node.tag)})`
@@ -294,7 +294,7 @@ function createDirectiveArgs(
): ArrayExpression {
// inject statement for resolving directive
const dirIdentifier = `_directive_${toValidId(dir.name)}`
context.statements.push(
context.statements.add(
`const ${dirIdentifier} = ${context.helper(
RESOLVE_DIRECTIVE
)}(${JSON.stringify(dir.name)})`