Add Webpack Compression plugin in prod build

This commit is contained in:
Corentin 2021-10-07 17:15:37 +09:00
commit 5e21b9d8ff
2 changed files with 10 additions and 9 deletions

View file

@ -1,6 +1,9 @@
const webpack = require('webpack');
const config = require('./webpack.base.js');
const CompressionPlugin = require("compression-webpack-plugin")
module.exports = Object.assign(
config,
{
@ -16,6 +19,12 @@ module.exports = Object.assign(
{
'DEBUG': false
} // set a DEBUG flag that can be used in the scripts (can be skipped)
}),
new CompressionPlugin(
{
algorithm: "gzip",
test: [/\.js$/, /\.svg$/],
threshold: 1000
})
])
}