Skip to content

Commit

Permalink
feat(build): introduce compression-webpack-plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
hiroppy committed Jan 23, 2021
1 parent 90c6fad commit c82d97a
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
21 changes: 21 additions & 0 deletions packages/fusuma/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/fusuma/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"caporal": "^1.4.0",
"chalk": "^4.1.0",
"child-process-promise": "^2.2.1",
"compression-webpack-plugin": "^7.1.2",
"core-js": "^3.8.3",
"css-loader": "^5.0.1",
"deepmerge": "^4.2.2",
Expand Down
7 changes: 7 additions & 0 deletions packages/fusuma/src/webpack/webpack.prod.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
const TerserPlugin = require('terser-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const CompressionPlugin = require('compression-webpack-plugin');
const css = require('./css');

function prod() {
Expand All @@ -20,6 +21,12 @@ function prod() {
filename: '[name].[chunkhash].css',
chunkFilename: '[name].[id].[chunkhash].css',
}),
// github pages doesn't support brotli
new CompressionPlugin({
test: /\.(js|css|html|svg)$/,
threshold: 10240,
minRatio: 0.8,
}),
// new webpack.optimize.AggressiveMergingPlugin() // if use this, canvas will be broken
],
optimization: {
Expand Down

0 comments on commit c82d97a

Please sign in to comment.