From 678378afd559481badb486b243722b6287862e09 Mon Sep 17 00:00:00 2001 From: Evan You Date: Mon, 27 Nov 2023 15:06:07 +0800 Subject: [PATCH] fix(compiler-sfc): use correct compiler when re-parsing in ssr mode --- 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 c34342a7a0c..1afdc74bf22 100644 --- a/packages/compiler-sfc/src/compileTemplate.ts +++ b/packages/compiler-sfc/src/compileTemplate.ts @@ -218,7 +218,7 @@ function doCompileTemplate({ // input AST has codegenNode - it has already been transformed and cannot // be reused. 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 = compiler.parse(inAST.source, { + const newAST = (ssr ? CompilerDOM : compiler).parse(inAST.source, { parseMode: 'sfc', onError: e => errors.push(e) })