|
|
@@ -55,22 +55,24 @@ export default ({ mode }) => defineConfig({
|
|
|
// }
|
|
|
},
|
|
|
build: {
|
|
|
- // 生成环境移除console
|
|
|
- terserOptions: {
|
|
|
- compress: {
|
|
|
- drop_console: true,
|
|
|
- drop_debugger: true
|
|
|
- }
|
|
|
- },
|
|
|
rollupOptions: {
|
|
|
input: entryConfig(),
|
|
|
output: { //静态资源分类打包
|
|
|
chunkFileNames: 'js/[name]-[hash].js',
|
|
|
entryFileNames: 'js/[name]-[hash].js',
|
|
|
- assetFileNames: 'static/[name]-[hash].[ext]'
|
|
|
+ assetFileNames: 'static/[name]-[hash].[ext]',
|
|
|
+ // 拆分node_modules包
|
|
|
+ manualChunks: (id) => {
|
|
|
+ if (id.includes("node_modules")) {
|
|
|
+ return id
|
|
|
+ .toString()
|
|
|
+ .split("node_modules/")[1]
|
|
|
+ .split("/")[0]
|
|
|
+ .toString();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- },
|
|
|
- reportCompressedSize: false
|
|
|
+ }
|
|
|
},
|
|
|
define: { //环境变量配置
|
|
|
'process.env': {
|