From fd98bda0ebb7b767ef69cdcf3b7fef6074c870ff Mon Sep 17 00:00:00 2001 From: zhanghao <774378400@qq.com> Date: Wed, 26 Aug 2026 08:44:42 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96monaco-editor?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E9=85=8D=E7=BD=AE=EF=BC=8C=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E8=AF=AD=E8=A8=80=E5=B7=A5=E4=BD=9C=E8=80=85=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vite.config.js | 15 +++++++-------- vite/plugins/index.js | 2 +- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/vite.config.js b/vite.config.js index 678a256..6377465 100644 --- a/vite.config.js +++ b/vite.config.js @@ -23,14 +23,13 @@ export default defineConfig(({ mode, command }) => { plugins: createVitePlugins(env, command === 'build'), optimizeDeps: { exclude: [ - ...(isCommonLinked ? ['@cmvr/iot-common'] : []), - 'monaco-editor', - 'monaco-editor/esm/vs/base/worker/workerMain.js', - 'monaco-editor/esm/vs/editor/editor.main.js', - 'ts.worker.js', - 'typescript' + ...(isCommonLinked ? ['@cmvr/iot-common'] : []) ], include: [ + 'monaco-editor/esm/vs/editor/editor.all.js', + 'monaco-editor/esm/vs/editor/editor.api.js', + 'monaco-editor/esm/vs/basic-languages/javascript/javascript.contribution.js', + 'monaco-editor/esm/vs/language/json/monaco.contribution.js', 'monaco-editor/esm/vs/language/typescript/monaco.contribution' ] }, @@ -55,8 +54,8 @@ export default defineConfig(({ mode, command }) => { chunkSizeWarningLimit: 2000, rollupOptions: { output: { - manualChunks: { - monaco: ['monaco-editor'] + manualChunks(id) { + if (id.includes('/node_modules/monaco-editor/')) return 'monaco' }, chunkFileNames: 'static/js/[name]-[hash].js', entryFileNames: 'static/js/[name]-[hash].js', diff --git a/vite/plugins/index.js b/vite/plugins/index.js index fede791..e614915 100644 --- a/vite/plugins/index.js +++ b/vite/plugins/index.js @@ -12,7 +12,7 @@ export default function createVitePlugins(viteEnv, isBuild = false) { const vitePlugins = [ vue(), monacoEditorPlugin({ - languages: ['javascript', 'html', 'css', 'json', 'python', 'java'] + languageWorkers: ['editorWorkerService', 'json', 'typescript'] }) ] vitePlugins.push(createAutoImport())