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

Commit

Permalink
Optimization of assets (#585)
Browse files Browse the repository at this point in the history
* quick optimization of assets

* typo
  • Loading branch information
mmahalwy authored Jan 16, 2017
1 parent a381c62 commit 575227b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"cache-manager": "1.5.0",
"clean-webpack-plugin": "0.1.10",
"compression": "1.6.2",
"compression-webpack-plugin": "0.3.2",
"cookie-parser": "1.4.3",
"copy-to-clipboard": "3.0.5",
"cors": "2.7.1",
Expand Down Expand Up @@ -92,6 +93,7 @@
"react-dom": "15.4.1",
"react-helmet": "3.1.0",
"react-inlinesvg": "0.5.4",
"react-intl": "2.1.5",
"react-metrics": "1.2.1",
"react-paginate": "4.1.0",
"react-redux": "5.0.1",
Expand All @@ -117,7 +119,6 @@
"url-loader": "0.5.7",
"webpack": "2.1.0-beta.20",
"webpack-isomorphic-tools": "2.5.7",
"react-intl": "2.1.5",
"winston": "1.1.2"
},
"devDependencies": {
Expand Down Expand Up @@ -170,6 +171,7 @@
"wdio-mocha-framework": "0.3.7",
"wdio-spec-reporter": "0.0.3",
"webdriverio": "4.2.1",
"webpack-bundle-analyzer": "2.2.1",
"webpack-dev-server": "1.6.5",
"webpack-hot-middleware": "2.12.2"
},
Expand Down
4 changes: 3 additions & 1 deletion webpack/dev.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
require('dotenv').load();
const webpack = require('webpack');
const path = require('path');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const IsomorphicPlugin = require('webpack-isomorphic-tools/plugin');
const webpackIsomorphicToolsPlugin = new IsomorphicPlugin(require('./isomorphic-tools-configuration')); // eslint-disable-line max-len, global-require

Expand Down Expand Up @@ -113,7 +114,8 @@ module.exports = {
new webpack.EnvironmentPlugin([
'NODE_ENV'
]),
webpackIsomorphicToolsPlugin.development()
webpackIsomorphicToolsPlugin.development(),
new BundleAnalyzerPlugin()
],
stats: {
colors: true,
Expand Down
11 changes: 10 additions & 1 deletion webpack/prod.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
const path = require('path');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const webpack = require('webpack');
const CompressionPlugin = require('compression-webpack-plugin');
const CleanPlugin = require('clean-webpack-plugin');
const IsomorphicPlugin = require('webpack-isomorphic-tools/plugin');
const strip = require('strip-loader');

const webpackIsomorphicToolsPlugin = new IsomorphicPlugin(require('./isomorphic-tools-configuration')); // eslint-disable-line max-len, global-require

const relativeAssetsPath = '../static/dist';
const assetsPath = path.join(__dirname, relativeAssetsPath);

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

},
context: path.resolve(__dirname, '../src'),
devtool: 'cheap-source-map',
devtool: 'cheap-module-source-map',
debug: false,
target: 'web',
cache: false,
Expand Down Expand Up @@ -142,6 +144,13 @@ module.exports = {
minimize: true,
debug: false
}),
new CompressionPlugin({
asset: '[path].gz[query]',
algorithm: 'gzip',
test: /\.js$|\.css$|\.html$/,
threshold: 10240,
minRatio: 0
}),
webpackIsomorphicToolsPlugin
]
};

0 comments on commit 575227b

Please sign in to comment.