Browse Source

Signed-off-by: caner <5658514@qq.com>

caner 3 years ago
parent
commit
ec40655f4b
2 changed files with 12 additions and 16 deletions
  1. 0 6
      .vscode/settings.json
  2. 12 10
      vite.config.js

+ 0 - 6
.vscode/settings.json

@@ -1,6 +0,0 @@
-{
-    // #每次保存的时候将代码按eslint格式进行修复
-    "editor.codeActionsOnSave": {
-        "source.fixAll.eslint": true
-    }
-}

+ 12 - 10
vite.config.js

@@ -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': {