]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(compiler-sfc): use compilerOptions when re-parsing consumed AST
authorEvan You <yyx990803@gmail.com>
Tue, 2 Jan 2024 02:55:10 +0000 (10:55 +0800)
committerEvan You <yyx990803@gmail.com>
Tue, 2 Jan 2024 13:38:13 +0000 (21:38 +0800)
fixes hydration error for custom elements

packages/compiler-sfc/src/compileTemplate.ts
packages/sfc-playground/src/App.vue

index 019aa5b0d65bd60c064e3a55e4429be99ed69637..5b7fe268366a59d474c2feef6b13178a72ce15b4 100644 (file)
@@ -219,6 +219,7 @@ 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,
       parseMode: 'sfc',
       onError: e => errors.push(e),
     })
index de6c24dded04cb24d9ad24cdfcf63670aaa4f591..e8aeeeaef5637262ac4bfb94efaf1ad4b9f58463 100644 (file)
@@ -70,8 +70,8 @@ const sfcOptions: SFCOptions = {
   template: {
     isProd: useProdMode.value,
     compilerOptions: {
-      isCustomElement: (tag: string) => tag === 'mjx-container'
-    }
+      isCustomElement: (tag: string) => tag === 'mjx-container',
+    },
   },
 }