diff --git a/Tool/webtool/index.html b/Tool/webtool/index.html index 8388c4b..cbcdcdc 100644 --- a/Tool/webtool/index.html +++ b/Tool/webtool/index.html @@ -2,9 +2,9 @@
- + -
- Edit
- components/HelloWorld.vue
to test HMR
-
- Check out - create-vue, the official Vue + Vite starter -
-- Install - Volar - in your IDE for a better DX -
-Click on the Vite and Vue logos to learn more
- - - diff --git a/Tool/webtool/src/main.js b/Tool/webtool/src/main.js index 2425c0f..1c58693 100644 --- a/Tool/webtool/src/main.js +++ b/Tool/webtool/src/main.js @@ -1,5 +1,27 @@ -import { createApp } from 'vue' -import './style.css' -import App from './App.vue' +import { createApp } from 'vue'; +import './style.css'; +import App from './App.vue'; +import editorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker'; +import jsonWorker from 'monaco-editor/esm/vs/language/json/json.worker?worker'; +import cssWorker from 'monaco-editor/esm/vs/language/css/css.worker?worker'; +import htmlWorker from 'monaco-editor/esm/vs/language/html/html.worker?worker'; +import tsWorker from 'monaco-editor/esm/vs/language/typescript/ts.worker?worker'; -createApp(App).mount('#app') +self.MonacoEnvironment = { + getWorker(_, label) { + if (label === 'json') { + return new jsonWorker(); + } + if (label === 'css' || label === 'scss' || label === 'less') { + return new cssWorker(); + } + if (label === 'html' || label === 'handlebars' || label === 'razor') { + return new htmlWorker(); + } + if (label === 'typescript' || label === 'javascript') { + return new tsWorker(); + } + return new editorWorker(); + }, +}; +createApp(App).mount('#app');