Skip to content

Commit

Permalink
fix: ensure consistent user template options when reusing AST
Browse files Browse the repository at this point in the history
Note: requires vue 3.4.1
proper fix for #322
  • Loading branch information
yyx990803 committed Dec 30, 2023
1 parent a13f09b commit bc0ad64
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/plugin-vue/src/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ export function resolveTemplateCompilerOptions(
return {
...options.template,
id,
ast: descriptor.template?.ast,
filename,
scoped: hasScoped,
slotted: descriptor.slotted,
Expand Down
3 changes: 2 additions & 1 deletion packages/plugin-vue/src/utils/descriptorCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@ const prevCache = new Map<string, SFCDescriptor | undefined>()
export function createDescriptor(
filename: string,
source: string,
{ root, isProduction, sourceMap, compiler }: ResolvedOptions,
{ root, isProduction, sourceMap, compiler, template }: ResolvedOptions,
hmr = false,
): SFCParseResult {
const { descriptor, errors } = compiler.parse(source, {
filename,
sourceMap,
templateParseOptions: template?.compilerOptions,
})

// ensure the path is normalized in a way that is consistent inside
Expand Down

0 comments on commit bc0ad64

Please sign in to comment.