From 1b6fc68ce2f7d07f7884e35ad91894d38534bef9 Mon Sep 17 00:00:00 2001 From: wangsongsole Date: Wed, 24 May 2023 18:05:49 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=91=EF=B8=8F=20hotfix:=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E8=AF=AD=E6=B3=95=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/webpack.config.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/config/webpack.config.js b/config/webpack.config.js index 6c4cd457..b2e8d32e 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -592,14 +592,15 @@ module.exports = function (webpackEnv) { ] }, plugins: [ - new CompressionPlugin({ - filename: '[path].gz[query]', // 目标资源名称。[file] 会被替换成原资源。[path] 会被替换成原资源路径,[query] 替换成原查询字符串 - algorithm: 'gzip', // 算法 - test: new RegExp('\\.(js|css)$'), // 压缩 js 与 css - threshold: 1024, // 只处理比这个值大的资源。按字节计算 - minRatio: 0.8, // 只有压缩率比这个值小的资源才会被处理 - deleteOriginalAssets: true - }), + process.env.NODE_ENV !== 'development' && + new CompressionPlugin({ + filename: '[path].gz[query]', // 目标资源名称。[file] 会被替换成原资源。[path] 会被替换成原资源路径,[query] 替换成原查询字符串 + algorithm: 'gzip', // 算法 + test: new RegExp('\\.(js|css)$'), // 压缩 js 与 css + threshold: 1024, // 只处理比这个值大的资源。按字节计算 + minRatio: 0.8, // 只有压缩率比这个值小的资源才会被处理 + deleteOriginalAssets: true + }), // Generates an `index.html` file with the