Commit 7b2105d9 authored by gxkai's avatar gxkai

fix: 开启压缩

parent 78d4f269
...@@ -16,16 +16,16 @@ module.exports = config => { ...@@ -16,16 +16,16 @@ module.exports = config => {
} }
webpackConfig.plugins.push(new WebpackBar()) webpackConfig.plugins.push(new WebpackBar())
if (process.env.NODE_ENV === 'production') { if (process.env.NODE_ENV === 'production') {
// const CompressionPlugin = require('compression-webpack-plugin') const CompressionPlugin = require('compression-webpack-plugin')
// const productionGzipExtensions = ['js', 'css', 'svg', 'ttf', 'otf', 'eot', 'woff', 'woff2', 'webp', 'png', 'sol'] const productionGzipExtensions = ['js', 'css', 'svg', 'ttf', 'otf', 'eot', 'woff', 'woff2', 'webp', 'png', 'sol']
// webpackConfig.plugins.push(new CompressionPlugin({ webpackConfig.plugins.push(new CompressionPlugin({
// filename: '[path].gz[query]', filename: '[path].gz[query]',
// algorithm: 'gzip', algorithm: 'gzip',
// test: new RegExp('\\.(' + productionGzipExtensions.join('|') + ')$'), test: new RegExp('\\.(' + productionGzipExtensions.join('|') + ')$'),
// threshold: 10240, // 只有大小大于该值的资源会被处理 10240 threshold: 10240, // 只有大小大于该值的资源会被处理 10240
// minRatio: 0.8, // 只有压缩率小于这个值的资源才会被处理 minRatio: 0.8, // 只有压缩率小于这个值的资源才会被处理
// deleteOriginalAssets: false // 删除原文件true=删 deleteOriginalAssets: false // 删除原文件true=删
// })) }))
return { return {
...webpackConfig, ...webpackConfig,
optimization: { optimization: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment