Added gzip compression for JS files

This commit is contained in:
2021-08-21 05:36:23 +10:00
parent 22e6286e0a
commit 7547b1717e
4 changed files with 654 additions and 554 deletions
+8
View File
@@ -2,6 +2,7 @@
const { DefinePlugin } = require('webpack');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CompressionPlugin = require('compression-webpack-plugin');
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
//libraries
@@ -72,6 +73,13 @@ module.exports = ({ production, analyzer }) => {
removeAttributeQuotes: production
}
}),
new CompressionPlugin({
filename: "[path][base].gz[query]",
algorithm: "gzip",
test: /\.js$|\.css$/,
minRatio: 0.8,
deleteOriginalAssets: true
}),
new BundleAnalyzerPlugin({
analyzerMode: analyzer ? 'server' : 'disabled'
})