fix(compiler-sfc): use compilerOptions when re-parsing consumed AST

fixes hydration error for custom elements
This commit is contained in:
Evan You 2024-01-02 10:55:10 +08:00
parent be7eabda22
commit d94d8d4bff
2 changed files with 3 additions and 2 deletions

View 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),
})

View 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',
},
},
}