Skip to content

Commit 7b987d9

Browse files
authored
fix(compiler-core): should alias name in helperString (#743)
fix #740
1 parent 478b4cf commit 7b987d9

File tree

3 files changed

+2
-6
lines changed

3 files changed

+2
-6
lines changed

packages/compiler-core/__tests__/transforms/vBind.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ describe('compiler: transform v-bind', () => {
137137
expect(props.properties[0]).toMatchObject({
138138
key: {
139139
children: [
140-
`${helperNameMap[CAMELIZE]}(`,
140+
`_${helperNameMap[CAMELIZE]}(`,
141141
{ content: `_ctx.foo` },
142142
`(`,
143143
{ content: `_ctx.bar` },

packages/compiler-core/src/transform.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,7 @@ export function createTransformContext(
161161
return name
162162
},
163163
helperString(name) {
164-
return (
165-
(context.prefixIdentifiers ? `` : `_`) +
166-
helperNameMap[context.helper(name)]
167-
)
164+
return `_${helperNameMap[context.helper(name)]}`
168165
},
169166
replaceNode(node) {
170167
/* istanbul ignore if */

packages/compiler-core/src/transforms/transformElement.ts

-1
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,6 @@ function buildDirectiveArgs(
517517
const dirArgs: ArrayExpression['elements'] = []
518518
const runtime = directiveImportMap.get(dir)
519519
if (runtime) {
520-
context.helper(runtime)
521520
dirArgs.push(context.helperString(runtime))
522521
} else {
523522
// inject statement for resolving directive

0 commit comments

Comments
 (0)