diff --git a/packages/plugin-vue/src/template.ts b/packages/plugin-vue/src/template.ts index aee99a74..b2c00f69 100644 --- a/packages/plugin-vue/src/template.ts +++ b/packages/plugin-vue/src/template.ts @@ -186,6 +186,7 @@ export function resolveTemplateCompilerOptions( return { ...options.template, id, + ast: descriptor.template?.ast, filename, scoped: hasScoped, slotted: descriptor.slotted, diff --git a/packages/plugin-vue/src/utils/descriptorCache.ts b/packages/plugin-vue/src/utils/descriptorCache.ts index 584adb39..8637430b 100644 --- a/packages/plugin-vue/src/utils/descriptorCache.ts +++ b/packages/plugin-vue/src/utils/descriptorCache.ts @@ -22,12 +22,13 @@ const prevCache = new Map() 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