diff --git a/src/monaco/env.ts b/src/monaco/env.ts index 666e9ac4..2aefbc2b 100644 --- a/src/monaco/env.ts +++ b/src/monaco/env.ts @@ -76,7 +76,9 @@ let disposeVue: undefined | (() => void) export async function reloadLanguageTools(store: Store) { disposeVue?.() - let dependencies = {} + let dependencies: Record = { + ...store.state.dependencyVersion, + } if (store.vueVersion) { dependencies = { diff --git a/src/monaco/vue.worker.ts b/src/monaco/vue.worker.ts index 079838e3..1988cfa2 100644 --- a/src/monaco/vue.worker.ts +++ b/src/monaco/vue.worker.ts @@ -19,7 +19,7 @@ export interface CreateData { compilerOptions?: import('typescript').CompilerOptions vueCompilerOptions?: Partial } - dependencies: {} + dependencies: Record } let locale: string diff --git a/src/store.ts b/src/store.ts index 117335ba..a8c2214e 100644 --- a/src/store.ts +++ b/src/store.ts @@ -90,6 +90,8 @@ export interface StoreState { locale?: string | undefined // used to force reset the sandbox resetFlip: boolean + /** { dep: version } */ + dependencyVersion?: Record } export interface SFCOptions { @@ -194,8 +196,10 @@ export class ReplStore implements Store { this.state.typescriptVersion, this.state.typescriptLocale, this.state.locale, + this.state.dependencyVersion, ], - () => this.reloadLanguageTools?.() + () => this.reloadLanguageTools?.(), + { deep: true } ) this.state.errors = [] @@ -417,6 +421,7 @@ export class ReplStore implements Store { imports['vue/server-renderer'] = ssrUrl this.setImportMap(importMap) this.forceSandboxReset() + this.reloadLanguageTools?.() console.info(`[@vue/repl] Now using Vue version: ${version}`) }