diff --git a/packages/plugin-vue/src/template.ts b/packages/plugin-vue/src/template.ts index b2c00f69..0cded2dd 100644 --- a/packages/plugin-vue/src/template.ts +++ b/packages/plugin-vue/src/template.ts @@ -186,7 +186,9 @@ export function resolveTemplateCompilerOptions( return { ...options.template, id, - ast: descriptor.template?.ast, + ast: canReuseAST(options.compiler.version) + ? descriptor.template?.ast + : undefined, filename, scoped: hasScoped, slotted: descriptor.slotted, @@ -206,3 +208,17 @@ export function resolveTemplateCompilerOptions( }, } } + +/** + * Versions before 3.4.3 have issues when the user has passed additional + * tempalte parse options e.g. `isCustomElement`. + */ +function canReuseAST(version: string | undefined) { + if (version) { + const [_, minor, patch] = version.split('.').map(Number) + if (minor >= 4 && patch >= 3) { + return true + } + } + return false +}