File tree 1 file changed +9
-1
lines changed
1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,8 @@ export function useStore(
51
51
} : Partial < StoreState > = { } ,
52
52
serializedState ?: string ,
53
53
) : ReplStore {
54
+ const loading = ref ( false )
55
+
54
56
function applyBuiltinImportMap ( ) {
55
57
const importMap = mergeImportMap ( builtinImportMap . value , getImportMap ( ) )
56
58
setImportMap ( importMap )
@@ -86,7 +88,10 @@ export function useStore(
86
88
watch ( vueVersion , async ( version ) => {
87
89
if ( version ) {
88
90
const compilerUrl = `https://cdn.jsdelivr.net/npm/@vue/compiler-sfc@${ version } /dist/compiler-sfc.esm-browser.js`
89
- compiler . value = await import ( /* @vite -ignore */ compilerUrl )
91
+ loading . value = true
92
+ compiler . value = await import ( /* @vite -ignore */ compilerUrl ) . finally (
93
+ ( ) => ( loading . value = false ) ,
94
+ )
90
95
console . info ( `[@vue/repl] Now using Vue version: ${ version } ` )
91
96
} else {
92
97
// reset to default
@@ -329,6 +334,7 @@ export function useStore(
329
334
outputMode,
330
335
sfcOptions,
331
336
compiler,
337
+ loading,
332
338
vueVersion,
333
339
334
340
locale,
@@ -402,6 +408,8 @@ export type StoreState = ToRefs<{
402
408
403
409
export interface ReplStore extends UnwrapRef < StoreState > {
404
410
activeFile : File
411
+ /** Loading compiler */
412
+ loading : boolean
405
413
init ( ) : void
406
414
setActive ( filename : string ) : void
407
415
addFile ( filename : string | File ) : void
You can’t perform that action at this time.
0 commit comments