Skip to content
This repository was archived by the owner on Jun 28, 2021. It is now read-only.

Commit 575227b

Browse files
authored
Optimization of assets (#585)
* quick optimization of assets * typo
1 parent a381c62 commit 575227b

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
"cache-manager": "1.5.0",
5757
"clean-webpack-plugin": "0.1.10",
5858
"compression": "1.6.2",
59+
"compression-webpack-plugin": "0.3.2",
5960
"cookie-parser": "1.4.3",
6061
"copy-to-clipboard": "3.0.5",
6162
"cors": "2.7.1",
@@ -92,6 +93,7 @@
9293
"react-dom": "15.4.1",
9394
"react-helmet": "3.1.0",
9495
"react-inlinesvg": "0.5.4",
96+
"react-intl": "2.1.5",
9597
"react-metrics": "1.2.1",
9698
"react-paginate": "4.1.0",
9799
"react-redux": "5.0.1",
@@ -117,7 +119,6 @@
117119
"url-loader": "0.5.7",
118120
"webpack": "2.1.0-beta.20",
119121
"webpack-isomorphic-tools": "2.5.7",
120-
"react-intl": "2.1.5",
121122
"winston": "1.1.2"
122123
},
123124
"devDependencies": {
@@ -170,6 +171,7 @@
170171
"wdio-mocha-framework": "0.3.7",
171172
"wdio-spec-reporter": "0.0.3",
172173
"webdriverio": "4.2.1",
174+
"webpack-bundle-analyzer": "2.2.1",
173175
"webpack-dev-server": "1.6.5",
174176
"webpack-hot-middleware": "2.12.2"
175177
},

webpack/dev.config.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
require('dotenv').load();
22
const webpack = require('webpack');
33
const path = require('path');
4+
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
45
const IsomorphicPlugin = require('webpack-isomorphic-tools/plugin');
56
const webpackIsomorphicToolsPlugin = new IsomorphicPlugin(require('./isomorphic-tools-configuration')); // eslint-disable-line max-len, global-require
67

@@ -113,7 +114,8 @@ module.exports = {
113114
new webpack.EnvironmentPlugin([
114115
'NODE_ENV'
115116
]),
116-
webpackIsomorphicToolsPlugin.development()
117+
webpackIsomorphicToolsPlugin.development(),
118+
new BundleAnalyzerPlugin()
117119
],
118120
stats: {
119121
colors: true,

webpack/prod.config.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
const path = require('path');
22
const ExtractTextPlugin = require('extract-text-webpack-plugin');
33
const webpack = require('webpack');
4+
const CompressionPlugin = require('compression-webpack-plugin');
45
const CleanPlugin = require('clean-webpack-plugin');
56
const IsomorphicPlugin = require('webpack-isomorphic-tools/plugin');
67
const strip = require('strip-loader');
78

89
const webpackIsomorphicToolsPlugin = new IsomorphicPlugin(require('./isomorphic-tools-configuration')); // eslint-disable-line max-len, global-require
10+
911
const relativeAssetsPath = '../static/dist';
1012
const assetsPath = path.join(__dirname, relativeAssetsPath);
1113

@@ -19,7 +21,7 @@ module.exports = {
1921

2022
},
2123
context: path.resolve(__dirname, '../src'),
22-
devtool: 'cheap-source-map',
24+
devtool: 'cheap-module-source-map',
2325
debug: false,
2426
target: 'web',
2527
cache: false,
@@ -142,6 +144,13 @@ module.exports = {
142144
minimize: true,
143145
debug: false
144146
}),
147+
new CompressionPlugin({
148+
asset: '[path].gz[query]',
149+
algorithm: 'gzip',
150+
test: /\.js$|\.css$|\.html$/,
151+
threshold: 10240,
152+
minRatio: 0
153+
}),
145154
webpackIsomorphicToolsPlugin
146155
]
147156
};

0 commit comments

Comments
 (0)