feat: 优化monaco-editor插件配置,更新语言工作者设置
This commit is contained in:
parent
6918460ac0
commit
fd98bda0eb
@ -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',
|
||||
|
||||
@ -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())
|
||||
|
||||
Loading…
Reference in New Issue
Block a user