Skip to content

Commit 4a53b6f

Browse files
committed
fix: only enable ast reuse for vue 3.4.3+
1 parent d94a704 commit 4a53b6f

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

packages/plugin-vue/src/template.ts

+17-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,9 @@ export function resolveTemplateCompilerOptions(
186186
return {
187187
...options.template,
188188
id,
189-
ast: descriptor.template?.ast,
189+
ast: canReuseAST(options.compiler.version)
190+
? descriptor.template?.ast
191+
: undefined,
190192
filename,
191193
scoped: hasScoped,
192194
slotted: descriptor.slotted,
@@ -206,3 +208,17 @@ export function resolveTemplateCompilerOptions(
206208
},
207209
}
208210
}
211+
212+
/**
213+
* Versions before 3.4.3 have issues when the user has passed additional
214+
* tempalte parse options e.g. `isCustomElement`.
215+
*/
216+
function canReuseAST(version: string | undefined) {
217+
if (version) {
218+
const [_, minor, patch] = version.split('.').map(Number)
219+
if (minor >= 4 && patch >= 3) {
220+
return true
221+
}
222+
}
223+
return false
224+
}

0 commit comments

Comments
 (0)