From 19212c41d91a35caf37481fc1248ec74c48dbf3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E6=99=BA=E5=AD=90=20Kevin=20Deng?= Date: Sun, 14 Jan 2024 03:26:44 +0800 Subject: [PATCH 1/2] fix(compiler-sfc): enable prefixIdentifiers by default --- packages/compiler-sfc/src/compileTemplate.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/compiler-sfc/src/compileTemplate.ts b/packages/compiler-sfc/src/compileTemplate.ts index 5b7fe268366..9dabb37d5fc 100644 --- a/packages/compiler-sfc/src/compileTemplate.ts +++ b/packages/compiler-sfc/src/compileTemplate.ts @@ -219,8 +219,9 @@ function doCompileTemplate({ // We need to parse a fresh one. Can't just use `source` here since we need // the AST location info to be relative to the entire SFC. const newAST = (ssr ? CompilerDOM : compiler).parse(inAST.source, { - ...compilerOptions, + prefixIdentifiers: true, parseMode: 'sfc', + ...compilerOptions, onError: e => errors.push(e), }) const template = newAST.children.find( From e5f0b080f35720927f068b9b91614a6ed67d960f Mon Sep 17 00:00:00 2001 From: Evan You Date: Sun, 14 Jan 2024 09:33:11 +0800 Subject: [PATCH 2/2] Update compileTemplate.ts --- packages/compiler-sfc/src/compileTemplate.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/compiler-sfc/src/compileTemplate.ts b/packages/compiler-sfc/src/compileTemplate.ts index 9dabb37d5fc..2d5ffdad7d8 100644 --- a/packages/compiler-sfc/src/compileTemplate.ts +++ b/packages/compiler-sfc/src/compileTemplate.ts @@ -220,8 +220,8 @@ function doCompileTemplate({ // the AST location info to be relative to the entire SFC. const newAST = (ssr ? CompilerDOM : compiler).parse(inAST.source, { prefixIdentifiers: true, - parseMode: 'sfc', ...compilerOptions, + parseMode: 'sfc', onError: e => errors.push(e), }) const template = newAST.children.find(