Skip to content

Commit

Permalink
fix: respect vue version at initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
sxzz committed Feb 10, 2024
1 parent 92be69c commit ef22052
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,20 +85,24 @@ export function useStore(
{ deep: true, immediate: true },
)

watch(vueVersion, async (version) => {
if (version) {
const compilerUrl = `https://cdn.jsdelivr.net/npm/@vue/compiler-sfc@${version}/dist/compiler-sfc.esm-browser.js`
loading.value = true
compiler.value = await import(/* @vite-ignore */ compilerUrl).finally(
() => (loading.value = false),
)
console.info(`[@vue/repl] Now using Vue version: ${version}`)
} else {
// reset to default
compiler.value = defaultCompiler
console.info(`[@vue/repl] Now using default Vue version`)
}
})
watch(
vueVersion,
async (version) => {
if (version) {
const compilerUrl = `https://cdn.jsdelivr.net/npm/@vue/compiler-sfc@${version}/dist/compiler-sfc.esm-browser.js`
loading.value = true
compiler.value = await import(/* @vite-ignore */ compilerUrl).finally(
() => (loading.value = false),
)
console.info(`[@vue/repl] Now using Vue version: ${version}`)
} else {
// reset to default
compiler.value = defaultCompiler
console.info(`[@vue/repl] Now using default Vue version`)
}
},
{ immediate: true },
)

watch(
sfcOptions,
Expand Down

0 comments on commit ef22052

Please sign in to comment.