Upgrade compression-webpack-plugin to version 1.0.1 (#5581)
parent
5521e94e24
commit
8ae9bd0eea
|
@ -9,6 +9,16 @@ const OfflinePlugin = require('offline-plugin');
|
||||||
const { publicPath } = require('./configuration.js');
|
const { publicPath } = require('./configuration.js');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
|
let compressionAlgorithm;
|
||||||
|
try {
|
||||||
|
const zopfli = require('node-zopfli');
|
||||||
|
compressionAlgorithm = (content, options, fn) => {
|
||||||
|
zopfli.gzip(content, options, fn);
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
compressionAlgorithm = 'gzip';
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = merge(sharedConfig, {
|
module.exports = merge(sharedConfig, {
|
||||||
output: {
|
output: {
|
||||||
filename: '[name]-[chunkhash].js',
|
filename: '[name]-[chunkhash].js',
|
||||||
|
@ -33,7 +43,7 @@ module.exports = merge(sharedConfig, {
|
||||||
}),
|
}),
|
||||||
new CompressionPlugin({
|
new CompressionPlugin({
|
||||||
asset: '[path].gz[query]',
|
asset: '[path].gz[query]',
|
||||||
algorithm: 'gzip',
|
algorithm: compressionAlgorithm,
|
||||||
test: /\.(js|css|html|json|ico|svg|eot|otf|ttf)$/,
|
test: /\.(js|css|html|json|ico|svg|eot|otf|ttf)$/,
|
||||||
}),
|
}),
|
||||||
new BundleAnalyzerPlugin({ // generates report.html and stats.json
|
new BundleAnalyzerPlugin({ // generates report.html and stats.json
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
"babel-preset-env": "^1.6.1",
|
"babel-preset-env": "^1.6.1",
|
||||||
"babel-preset-react": "^6.24.1",
|
"babel-preset-react": "^6.24.1",
|
||||||
"classnames": "^2.2.5",
|
"classnames": "^2.2.5",
|
||||||
"compression-webpack-plugin": "^0.4.0",
|
"compression-webpack-plugin": "^1.0.1",
|
||||||
"cross-env": "^5.1.1",
|
"cross-env": "^5.1.1",
|
||||||
"css-loader": "^0.28.4",
|
"css-loader": "^0.28.4",
|
||||||
"detect-passive-events": "^1.0.2",
|
"detect-passive-events": "^1.0.2",
|
||||||
|
@ -133,6 +133,7 @@
|
||||||
"yargs": "^8.0.2"
|
"yargs": "^8.0.2"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"fsevents": "*"
|
"fsevents": "*",
|
||||||
|
"node-zopfli": "^2.0.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
33
yarn.lock
33
yarn.lock
|
@ -277,9 +277,11 @@ async-foreach@^0.1.3:
|
||||||
version "0.1.3"
|
version "0.1.3"
|
||||||
resolved "https://registry.yarnpkg.com/async-foreach/-/async-foreach-0.1.3.tgz#36121f845c0578172de419a97dbeb1d16ec34542"
|
resolved "https://registry.yarnpkg.com/async-foreach/-/async-foreach-0.1.3.tgz#36121f845c0578172de419a97dbeb1d16ec34542"
|
||||||
|
|
||||||
async@0.2.x:
|
async@2.4.1:
|
||||||
version "0.2.10"
|
version "2.4.1"
|
||||||
resolved "https://registry.yarnpkg.com/async/-/async-0.2.10.tgz#b6bbe0b0674b9d719708ca38de8c237cb526c3d1"
|
resolved "https://registry.yarnpkg.com/async/-/async-2.4.1.tgz#62a56b279c98a11d0987096a01cc3eeb8eb7bbd7"
|
||||||
|
dependencies:
|
||||||
|
lodash "^4.14.0"
|
||||||
|
|
||||||
async@^1.4.0, async@^1.5.2:
|
async@^1.4.0, async@^1.5.2:
|
||||||
version "1.5.2"
|
version "1.5.2"
|
||||||
|
@ -1559,14 +1561,12 @@ compressible@~2.0.11:
|
||||||
dependencies:
|
dependencies:
|
||||||
mime-db ">= 1.30.0 < 2"
|
mime-db ">= 1.30.0 < 2"
|
||||||
|
|
||||||
compression-webpack-plugin@^0.4.0:
|
compression-webpack-plugin@^1.0.1:
|
||||||
version "0.4.0"
|
version "1.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/compression-webpack-plugin/-/compression-webpack-plugin-0.4.0.tgz#811de04215f811ea6a12d4d8aed8457d758f13ac"
|
resolved "https://registry.yarnpkg.com/compression-webpack-plugin/-/compression-webpack-plugin-1.0.1.tgz#7f0a2af9f642b4f87b5989516a3b9e9b41bb4b3f"
|
||||||
dependencies:
|
dependencies:
|
||||||
async "0.2.x"
|
async "2.4.1"
|
||||||
webpack-sources "^0.1.0"
|
webpack-sources "^1.0.1"
|
||||||
optionalDependencies:
|
|
||||||
node-zopfli "^2.0.0"
|
|
||||||
|
|
||||||
compression@^1.5.2:
|
compression@^1.5.2:
|
||||||
version "1.7.1"
|
version "1.7.1"
|
||||||
|
@ -4618,7 +4618,7 @@ node-sass@^4.5.2:
|
||||||
sass-graph "^2.1.1"
|
sass-graph "^2.1.1"
|
||||||
stdout-stream "^1.4.0"
|
stdout-stream "^1.4.0"
|
||||||
|
|
||||||
node-zopfli@^2.0.0:
|
node-zopfli@^2.0.2:
|
||||||
version "2.0.2"
|
version "2.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/node-zopfli/-/node-zopfli-2.0.2.tgz#a7a473ae92aaea85d4c68d45bbf2c944c46116b8"
|
resolved "https://registry.yarnpkg.com/node-zopfli/-/node-zopfli-2.0.2.tgz#a7a473ae92aaea85d4c68d45bbf2c944c46116b8"
|
||||||
dependencies:
|
dependencies:
|
||||||
|
@ -6622,10 +6622,6 @@ source-list-map@^2.0.0:
|
||||||
version "2.0.0"
|
version "2.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-2.0.0.tgz#aaa47403f7b245a92fbc97ea08f250d6087ed085"
|
resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-2.0.0.tgz#aaa47403f7b245a92fbc97ea08f250d6087ed085"
|
||||||
|
|
||||||
source-list-map@~0.1.7:
|
|
||||||
version "0.1.8"
|
|
||||||
resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-0.1.8.tgz#c550b2ab5427f6b3f21f5afead88c4f5587b2106"
|
|
||||||
|
|
||||||
source-map-resolve@^0.3.0:
|
source-map-resolve@^0.3.0:
|
||||||
version "0.3.1"
|
version "0.3.1"
|
||||||
resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.3.1.tgz#610f6122a445b8dd51535a2a71b783dfc1248761"
|
resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.3.1.tgz#610f6122a445b8dd51535a2a71b783dfc1248761"
|
||||||
|
@ -7313,13 +7309,6 @@ webpack-merge@^4.1.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
lodash "^4.17.4"
|
lodash "^4.17.4"
|
||||||
|
|
||||||
webpack-sources@^0.1.0:
|
|
||||||
version "0.1.5"
|
|
||||||
resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-0.1.5.tgz#aa1f3abf0f0d74db7111c40e500b84f966640750"
|
|
||||||
dependencies:
|
|
||||||
source-list-map "~0.1.7"
|
|
||||||
source-map "~0.5.3"
|
|
||||||
|
|
||||||
webpack-sources@^1.0.1:
|
webpack-sources@^1.0.1:
|
||||||
version "1.0.1"
|
version "1.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-1.0.1.tgz#c7356436a4d13123be2e2426a05d1dad9cbe65cf"
|
resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-1.0.1.tgz#c7356436a4d13123be2e2426a05d1dad9cbe65cf"
|
||||||
|
|
Reference in New Issue