From 08896ee96d5fbfbf80852435af210e5515cae9cb Mon Sep 17 00:00:00 2001 From: Joshua Kiwiet-Pantaleoni Date: Fri, 8 Sep 2023 11:43:01 -0700 Subject: [PATCH] feat: compress static assets for production MARS-429 --- build/webpack.base.conf.js | 10 ++++++++++ 1 file changed, 10 insertions(+) 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", + }), + ] : []), ] };