From 78a173f85f8a4666d83cf8d900f04dd9f8e3e127 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期二, 17 六月 2025 08:53:12 +0800
Subject: [PATCH] 提交一把订单

---
 company/vue.config.js |   38 +++++++++++++++++++++++++++++++++++++-
 1 files changed, 37 insertions(+), 1 deletions(-)

diff --git a/company/vue.config.js b/company/vue.config.js
index c8c48d1..336dec7 100644
--- a/company/vue.config.js
+++ b/company/vue.config.js
@@ -1,9 +1,10 @@
 // 璇︾粏閰嶇疆璇峰弬鑰僪ttps://cli.vuejs.org/zh/config/#vue-config-js
 // const outputDir = process.env.VUE_APP_CONTEXT_PATH.substring(1, process.env.VUE_APP_CONTEXT_PATH.length - 1)
 // const outputDir = process.env.VUE_APP_CONTEXT_PATH.substring(1, process.env.VUE_APP_CONTEXT_PATH.length)
+const CompressionPlugin = require('compression-webpack-plugin')
 module.exports = {
   publicPath: './',
-  outputDir: 'yyb_web',
+  outputDir: process.env.VUE_APP_CONTEXT_NAME,
   assetsDir: 'static',
   lintOnSave: false,
   devServer: {
@@ -18,5 +19,40 @@
         }
       }
     }
+  },
+  configureWebpack: config => {
+    // if (process.env.NODE_ENV === 'production' || process.env.NODE_ENV === 'test') {
+    return {
+      plugins: [
+        new CompressionPlugin({
+          algorithm: 'gzip', // 浣跨敤gzip鍘嬬缉
+          test: /\.(js|css|html)$/, // 鍖归厤鏂囦欢绫诲瀷
+          threshold: 10240, // 鍙鐞嗘瘮杩欎釜鍊煎ぇ鐨勮祫婧愩�傚�兼槸瀛楄妭锛�10240瀛楄妭=10KB
+          minRatio: 0.8 // 鍘嬬缉姣旂巼锛屽彧鏈夊帇缂╃巼灏忎簬杩欎釜鍊肩殑璧勬簮鎵嶄細琚鐞�
+        })
+      ],
+      optimization: {
+        runtimeChunk: 'single',
+        splitChunks: {
+          chunks: 'all',
+          maxInitialRequests: Infinity,
+          minSize: 20000,
+          cacheGroups: {
+            vendors: {
+              test: /[\\/]node_modules[\\/]/, // 浣跨敤姝e垯鍖归厤node_modules涓紩鍏ョ殑妯″潡
+              priority: -10, // 浼樺厛绾у�艰秺澶т紭鍏堢骇瓒婇珮锛岄粯璁�-10锛屼笉鐢ㄤ慨鏀�
+              name(module) {
+                // 璁惧畾鍒嗗寘浠ュ悗鐨勬枃浠舵ā鍧楀悕瀛楋紝鎸夌収鍖呭悕瀛楁浛鎹㈡嫾鎺ヤ竴涓�
+
+                if (!module.context.match(/[\\/]node_modules[\\/](.*?)([\\/]|$)/)) return;
+                const packageName = module.context.match(/[\\/]node_modules[\\/](.*?)([\\/]|$)/)[1];
+                return `npm.${packageName.replace('@', '')}`;
+              }
+            }
+          }
+        }
+      }
+    }
+    // }
   }
 }

--
Gitblit v1.9.3