Skip to content

Commit

Permalink
fix: ignore X_V_IF_SAME_KEY error in vue 2
Browse files Browse the repository at this point in the history
close #1638
  • Loading branch information
johnsoncodehk committed Jul 28, 2022
1 parent 0f93cb8 commit 20dfeb0
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions packages/vue-code-gen/src/vue2TemplateCompiler.ts
Expand Up @@ -8,12 +8,18 @@ export function compile(

const onError = options.onError;
options.onError = (error) => {
if (error.code === CompilerCore.ErrorCodes.X_V_FOR_TEMPLATE_KEY_PLACEMENT)
return; // :key binding allowed in v-for template child in vue 2
if (onError)
if (
error.code === CompilerCore.ErrorCodes.X_V_FOR_TEMPLATE_KEY_PLACEMENT // :key binding allowed in v-for template child in vue 2
|| error.code === CompilerCore.ErrorCodes.X_V_IF_SAME_KEY // fix https://github.com/johnsoncodehk/volar/issues/1638
) {
return;
}
if (onError) {
onError(error);
else
}
else {
throw error;
}
};

return baseCompile(
Expand Down

0 comments on commit 20dfeb0

Please sign in to comment.