Skip to content

Commit cd22490

Browse files
authored
fix: recompile vue sfc files when compiler changes (#374)
1 parent b85ec7d commit cd22490

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/store.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,19 @@ export function useStore(
107107
{ immediate: true },
108108
)
109109

110+
// Recompile all Vue SFC files when the compiler changes.
111+
// This ensures that when switching Vue versions (e.g., from <3.6 to >=3.6),
112+
// all vue sfc files are recompiled with the new compiler to correctly handle
113+
// vapor components.
114+
watch(compiler, (_, oldCompiler) => {
115+
if (!oldCompiler) return
116+
for (const file of Object.values(files.value)) {
117+
if (file.filename.endsWith('.vue')) {
118+
compileFile(store, file).then((errs) => errors.value.push(...errs))
119+
}
120+
}
121+
})
122+
110123
watch(
111124
sfcOptions,
112125
() => {

0 commit comments

Comments
 (0)