Commit 286e1e0c by lijiabin

【需求 21402】 wip: 优化打包配置

parent e87c7b31
......@@ -82,36 +82,24 @@ export default defineConfig(({ mode }) => {
// },
},
build: {
minify: 'esbuild', // 'esbuild'
minify: true, // 'esbuild'
chunkSizeWarningLimit: 1000,
rollupOptions: {
output: {
assetFileNames: 'assets/[ext]/[name]-[hash][extname]',
chunkFileNames: 'assets/js/[name]-[hash].js',
manualChunks: (id) => {
if (id.includes('node_modules')) {
if (id.includes('element-plus')) {
return 'element-plus'
} else if (id.includes('vue')) {
return 'vue'
} else if (id.includes('lodash-es')) {
return 'lodash-es'
} else if (id.includes('dayjs')) {
return 'dayjs'
} else if (id.includes('lodash-es')) {
return 'lodash-es'
} else if (id.includes('axios')) {
return 'axios'
} else if (id.includes('wangeditor')) {
return 'wangeditor'
}
// console.log(id)
return 'vendor'
}
codeSplitting: {
groups: [
{ name: 'elementPlus-vendor', test: /node_modules[\\/]element-plus/, priority: 9 },
{ name: 'vue-vendor', test: /node_modules[\\/]vue/, priority: 10 },
{ name: 'wangeditor-vendor', test: /node_modules[\\/]@wangeditor/, priority: 8 },
{
name: 'common',
minShareCount: 2,
priority: 5,
},
],
},
advancedChunks: {},
},
},
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment