Skip to content

Commit

Permalink
fix(compiler-sfc): use compilerOptions when re-parsing consumed AST
Browse files Browse the repository at this point in the history
fixes hydration error for custom elements
  • Loading branch information
yyx990803 committed Jan 2, 2024
1 parent be7eabd commit d94d8d4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/compiler-sfc/src/compileTemplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
})
Expand Down
4 changes: 2 additions & 2 deletions packages/sfc-playground/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ const sfcOptions: SFCOptions = {
template: {
isProd: useProdMode.value,
compilerOptions: {
isCustomElement: (tag: string) => tag === 'mjx-container'
}
isCustomElement: (tag: string) => tag === 'mjx-container',
},
},
}
Expand Down

0 comments on commit d94d8d4

Please sign in to comment.