Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit c82d97a

Browse files
committed
feat(build): introduce compression-webpack-plugin
1 parent 90c6fad commit c82d97a

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

packages/fusuma/package-lock.json

+21
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/fusuma/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
"caporal": "^1.4.0",
4343
"chalk": "^4.1.0",
4444
"child-process-promise": "^2.2.1",
45+
"compression-webpack-plugin": "^7.1.2",
4546
"core-js": "^3.8.3",
4647
"css-loader": "^5.0.1",
4748
"deepmerge": "^4.2.2",

packages/fusuma/src/webpack/webpack.prod.config.js

+7
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
const TerserPlugin = require('terser-webpack-plugin');
44
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
55
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
6+
const CompressionPlugin = require('compression-webpack-plugin');
67
const css = require('./css');
78

89
function prod() {
@@ -20,6 +21,12 @@ function prod() {
2021
filename: '[name].[chunkhash].css',
2122
chunkFilename: '[name].[id].[chunkhash].css',
2223
}),
24+
// github pages doesn't support brotli
25+
new CompressionPlugin({
26+
test: /\.(js|css|html|svg)$/,
27+
threshold: 10240,
28+
minRatio: 0.8,
29+
}),
2330
// new webpack.optimize.AggressiveMergingPlugin() // if use this, canvas will be broken
2431
],
2532
optimization: {

0 commit comments

Comments
 (0)