Skip to content

Commit 1b50904

Browse files
author
Marco
committed
latest
1 parent b3db4a8 commit 1b50904

File tree

2 files changed

+12
-22
lines changed

2 files changed

+12
-22
lines changed
Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,11 @@
11
import { loader } from '@monaco-editor/react';
2-
import * as monaco from 'monaco-editor';
3-
import editorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker';
4-
import jsonWorker from 'monaco-editor/esm/vs/language/json/json.worker?worker';
5-
import cssWorker from 'monaco-editor/esm/vs/language/css/css.worker?worker';
6-
import htmlWorker from 'monaco-editor/esm/vs/language/html/html.worker?worker';
7-
import tsWorker from 'monaco-editor/esm/vs/language/typescript/ts.worker?worker';
2+
import * as monaco from "monaco-editor/esm/vs/editor/editor.api.js";
3+
import EditorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker';
84

9-
// Reference: https://github.com/suren-atoyan/monaco-react?tab=readme-ov-file#use-monaco-editor-as-an-npm-package
105
self.MonacoEnvironment = {
11-
getWorker(_, label) {
12-
if (label === 'json') {
13-
return new jsonWorker();
14-
}
15-
if (label === 'css' || label === 'scss' || label === 'less') {
16-
return new cssWorker();
17-
}
18-
if (label === 'html' || label === 'handlebars' || label === 'razor') {
19-
return new htmlWorker();
20-
}
21-
if (label === 'typescript' || label === 'javascript') {
22-
return new tsWorker();
23-
}
24-
return new editorWorker();
25-
},
6+
getWorker: () => {
7+
return new EditorWorker();
8+
},
269
};
2710

2811
loader.config({ monaco });

components/webui/client/vite.config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ export default defineConfig({
77
base: "./",
88
build: {
99
target: "esnext",
10+
rollupOptions: {
11+
output: {
12+
manualChunks: {
13+
"monaco-editor": ["monaco-editor"],
14+
},
15+
},
16+
},
1017
},
1118
plugins: [
1219
react(),

0 commit comments

Comments
 (0)