diff --git a/build/webpack.base.conf.js b/build/webpack.base.conf.js index 340bdd39df..65e9cd6653 100644 --- a/build/webpack.base.conf.js +++ b/build/webpack.base.conf.js @@ -5,6 +5,7 @@ const VueLoaderPlugin = require('vue-loader').VueLoaderPlugin; const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const FilterWarningsPlugin = require('webpack-filter-warnings-plugin'); const webpack = require('webpack'); +const CompressionPlugin = require('compression-webpack-plugin'); const GitRevisionPlugin = require('git-revision-webpack-plugin'); const HardSourceWebpackPlugin = require('hard-source-webpack-plugin-fixed-hashbug'); const gitRevisionPlugin = new GitRevisionPlugin({ @@ -331,5 +332,14 @@ module.exports = { sizeThreshold: 500 * 1024 * 1024 } })]), + ...(isProd ? [ + // gzip compression + new CompressionPlugin(), + // brotli compression + new CompressionPlugin({ + filename: "[path][base].br", + algorithm: "brotliCompress", + }), + ] : []), ] };