Skip to content

Commit aab102a

Browse files
authored
perf: add webpack compression plugin (#38)
1 parent 725a98b commit aab102a

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"@types/react": "^16.0.5",
2828
"@types/react-dom": "^15.5.4",
2929
"awesome-typescript-loader": "^3.2.2",
30+
"compression-webpack-plugin": "^1.0.0",
3031
"css-loader": "^0.28.4",
3132
"del-cli": "^1.1.0",
3233
"enzyme": "^2.9.1",

webpack.config.production.js

+6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const webpack = require('webpack');
33
const ExtractTextPlugin = require('extract-text-webpack-plugin');
44
const OfflinePlugin = require('offline-plugin');
55
const NameAllModulesPlugin = require('name-all-modules-plugin');
6+
const CompressionPlugin = require('compression-webpack-plugin');
67

78
module.exports = {
89
output: {
@@ -47,6 +48,11 @@ module.exports = {
4748
ServiceWorker: {
4849
events: true
4950
}
51+
}),
52+
new CompressionPlugin({
53+
asset: '[path].gz[query]',
54+
algorithm: 'gzip',
55+
test: /\.(js|json|css|html)$/
5056
})
5157
]
5258
};

yarn.lock

+13
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,12 @@ async-each@^1.0.0:
312312
version "1.0.1"
313313
resolved "https://registry.yarnpkg.com/async-each/-/async-each-1.0.1.tgz#19d386a1d9edc6e7c1c85d388aedbcc56d33602d"
314314

315+
316+
version "2.4.1"
317+
resolved "https://registry.yarnpkg.com/async/-/async-2.4.1.tgz#62a56b279c98a11d0987096a01cc3eeb8eb7bbd7"
318+
dependencies:
319+
lodash "^4.14.0"
320+
315321
async@^0.9.0:
316322
version "0.9.2"
317323
resolved "https://registry.yarnpkg.com/async/-/async-0.9.2.tgz#aea74d5e61c1f899613bf64bda66d4c78f2fd17d"
@@ -1082,6 +1088,13 @@ compressible@~2.0.10:
10821088
dependencies:
10831089
mime-db ">= 1.29.0 < 2"
10841090

1091+
compression-webpack-plugin@^1.0.0:
1092+
version "1.0.0"
1093+
resolved "https://registry.yarnpkg.com/compression-webpack-plugin/-/compression-webpack-plugin-1.0.0.tgz#5c5eb6afd08ca6a5d66006eeef71da17b01bd676"
1094+
dependencies:
1095+
async "2.4.1"
1096+
webpack-sources "^1.0.1"
1097+
10851098
compression@^1.5.2:
10861099
version "1.7.0"
10871100
resolved "https://registry.yarnpkg.com/compression/-/compression-1.7.0.tgz#030c9f198f1643a057d776a738e922da4373012d"

0 commit comments

Comments
 (0)