From 1e1291830e6bb21b753246b46996f8cf72d23f48 Mon Sep 17 00:00:00 2001 From: xiaowen <372193233@qq.com> Date: Fri, 30 Sep 2022 09:54:21 +0800 Subject: [PATCH] cxw-010203 --- vue.config.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/vue.config.js b/vue.config.js index 9403680..1c5306f 100644 --- a/vue.config.js +++ b/vue.config.js @@ -7,7 +7,7 @@ * @FilePath: /data-show/vue.config.js */ const CompressionWebpackPlugin = require('compression-webpack-plugin') -const productionGzipExtensions = ['js', 'css', 'svg'] +const productionGzipExtensions = /\.(js|css|json|txt|html|ico|svg)(\?.*)?$/i // 1. 引入等比适配插件 const px2rem = require('postcss-px2rem') // 2. 配置基本大小 @@ -37,9 +37,10 @@ module.exports = { new CompressionWebpackPlugin({ filename: '[path].gz[query]', algorithm: 'gzip', - test: new RegExp('\\.(' + productionGzipExtensions.join('|') + ')$'), + test: productionGzipExtensions, threshold: 10240, - minRatio: 0.8 + minRatio: 0.8, + deleteOriginalAssets: false }) ) } else {