Skip to content

Commit a042d4c

Browse files
committed
feat: use ts version option for ts lib dts acquire
1 parent 0cc220d commit a042d4c

File tree

1 file changed

+25
-13
lines changed

1 file changed

+25
-13
lines changed

Diff for: src/monaco/env.ts

+25-13
Original file line numberDiff line numberDiff line change
@@ -78,25 +78,37 @@ let disposeVue: undefined | (() => void)
7878
export async function reloadVue(store: Store) {
7979
disposeVue?.()
8080

81+
let dependencies = {};
82+
83+
if (store.vueVersion) {
84+
dependencies = {
85+
...dependencies,
86+
vue: store.vueVersion,
87+
'@vue/compiler-core': store.vueVersion,
88+
'@vue/compiler-dom': store.vueVersion,
89+
'@vue/compiler-sfc': store.vueVersion,
90+
'@vue/compiler-ssr': store.vueVersion,
91+
'@vue/reactivity': store.vueVersion,
92+
'@vue/runtime-core': store.vueVersion,
93+
'@vue/runtime-dom': store.vueVersion,
94+
'@vue/shared': store.vueVersion,
95+
}
96+
}
97+
98+
if (store.state.typescriptVersion) {
99+
dependencies = {
100+
...dependencies,
101+
typescript: store.state.typescriptVersion,
102+
}
103+
}
104+
81105
const worker = editor.createWebWorker<any>({
82106
moduleId: 'vs/language/vue/vueWorker',
83107
label: 'vue',
84108
host: new WorkerHost(),
85109
createData: {
86110
tsconfig: store.getTsConfig?.() || {},
87-
dependencies: !store.vueVersion
88-
? {}
89-
: {
90-
vue: store.vueVersion,
91-
'@vue/compiler-core': store.vueVersion,
92-
'@vue/compiler-dom': store.vueVersion,
93-
'@vue/compiler-sfc': store.vueVersion,
94-
'@vue/compiler-ssr': store.vueVersion,
95-
'@vue/reactivity': store.vueVersion,
96-
'@vue/runtime-core': store.vueVersion,
97-
'@vue/runtime-dom': store.vueVersion,
98-
'@vue/shared': store.vueVersion,
99-
},
111+
dependencies,
100112
} satisfies CreateData,
101113
})
102114
const languageId = ['vue', 'javascript', 'typescript']

0 commit comments

Comments
 (0)