Merge branch 'master' into redPackets

This commit is contained in:
wangsongsole 2023-05-24 18:08:57 +08:00
commit 2ab3c64110
1 changed files with 9 additions and 8 deletions

View File

@ -592,14 +592,15 @@ module.exports = function (webpackEnv) {
] ]
}, },
plugins: [ plugins: [
new CompressionPlugin({ process.env.NODE_ENV !== 'development' &&
filename: '[path].gz[query]', // 目标资源名称。[file] 会被替换成原资源。[path] 会被替换成原资源路径,[query] 替换成原查询字符串 new CompressionPlugin({
algorithm: 'gzip', // 算法 filename: '[path].gz[query]', // 目标资源名称。[file] 会被替换成原资源。[path] 会被替换成原资源路径,[query] 替换成原查询字符串
test: new RegExp('\\.(js|css)$'), // 压缩 js 与 css algorithm: 'gzip', // 算法
threshold: 1024, // 只处理比这个值大的资源。按字节计算 test: new RegExp('\\.(js|css)$'), // 压缩 js 与 css
minRatio: 0.8, // 只有压缩率比这个值小的资源才会被处理 threshold: 1024, // 只处理比这个值大的资源。按字节计算
deleteOriginalAssets: true minRatio: 0.8, // 只有压缩率比这个值小的资源才会被处理
}), deleteOriginalAssets: true
}),
// Generates an `index.html` file with the <script> injected. // Generates an `index.html` file with the <script> injected.
new HtmlWebpackPlugin( new HtmlWebpackPlugin(
Object.assign( Object.assign(