Skip to content

Commit 86cdf66

Browse files
authored
chore(compiler-core): improve X_V_IF_KEY error message (#1757)
1 parent 0cd98c3 commit 86cdf66

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/compiler-core/src/errors.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,10 @@ export const errorMessages: { [code: number]: string } = {
136136

137137
// transform errors
138138
[ErrorCodes.X_V_IF_NO_EXPRESSION]: `v-if/v-else-if is missing expression.`,
139-
[ErrorCodes.X_V_IF_KEY]: `v-if branches must use compiler generated keys.`,
139+
[ErrorCodes.X_V_IF_KEY]:
140+
`v-if branches must use compiler generated keys. ` +
141+
`In many cases, you can simply remove this key. ` +
142+
`If this tag is inside of a <template v-for="...">, then you can move the key up to the parent <template>.`,
140143
[ErrorCodes.X_V_ELSE_NO_ADJACENT_IF]: `v-else/v-else-if has no adjacent v-if.`,
141144
[ErrorCodes.X_V_FOR_NO_EXPRESSION]: `v-for is missing expression.`,
142145
[ErrorCodes.X_V_FOR_MALFORMED_EXPRESSION]: `v-for has invalid expression.`,

0 commit comments

Comments
 (0)