From 7cab3f6556573b75cbc2a1f58937730b279132b8 Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Thu, 19 Dec 2024 11:21:46 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E7=BC=96=E8=AF=91=E4=BE=9D=E8=B5=96?= =?UTF-8?q?=E6=8B=86=E5=8C=85manualChunks=E8=A1=8C=E4=B8=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vite.config.ts | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/vite.config.ts b/vite.config.ts index f719d7f8..d8539cb5 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -66,10 +66,27 @@ export default defineConfig(({ mode }) => { chunkFileNames: 'js/[name].[hash].js', // 用于输出静态资源的块 assetFileNames: 'assets/[name].[hash].[ext]', - manualChunks: id => { - if (id.indexOf('node_modules') !== -1) { - return 'vendor/index'; - } + manualChunks: { + vendorVue: ['vue', 'vue-router', 'pinia'], + vendorVuePlugins: [ + 'vue-i18n', + 'vue3-smooth-dnd', + 'grid-layout-plus', + '@vueuse/core', + ], + vendorAnt: ['ant-design-vue', '@ant-design/icons-vue'], + vendorAntv: ['@antv/g6'], + vendorEcharts: ['echarts'], + vendorPDF: ['@tato30/vue-pdf'], + vendorXterm: ['@xterm/xterm', '@xterm/addon-fit'], + vendorCodemirror: [ + 'codemirror', + '@codemirror/lang-yaml', + '@codemirror/lang-javascript', + '@codemirror/merge', + '@codemirror/theme-one-dark', + ], + vendorUtils: ['crypto-js', 'nprogress', 'p-queue', 'dayjs', 'xlsx'], }, }, }, @@ -107,4 +124,4 @@ export default defineConfig(({ mode }) => { }), ], }; -}); \ No newline at end of file +});