Skip to content

Commit

Permalink
Configure AutoDLL to speed up build
Browse files Browse the repository at this point in the history
  • Loading branch information
flekschas committed Nov 3, 2017
1 parent 53e8bdd commit 4d83b1b
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 5 deletions.
3 changes: 2 additions & 1 deletion config.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"homepageDemos": false,
"server": ""
"server": "",
"sourceMaps": false
}
51 changes: 47 additions & 4 deletions config/webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const autoprefixer = require('autoprefixer');
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const AutoDllPlugin = require('autodll-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const ManifestPlugin = require('webpack-manifest-plugin');
const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');
Expand Down Expand Up @@ -81,7 +82,7 @@ module.exports = {
bail: true,
// We generate sourcemaps in production. This is slow but gives good results.
// You can exclude the *.map files from the build during deployment.
devtool: 'source-map',
// devtool: 'source-map',
// In production, we only want to load the polyfills and the app code.
entry: [require.resolve('./polyfills'), paths.appIndexJs],
output: {
Expand Down Expand Up @@ -223,7 +224,7 @@ module.exports = {
options: {
importLoaders: 1,
minimize: true,
sourceMap: true,
sourceMap: config.sourceMaps || false,
},
},
{
Expand Down Expand Up @@ -266,7 +267,7 @@ module.exports = {
options: {
importLoaders: 1,
minimize: true,
sourceMap: true,
sourceMap: config.sourceMaps || false,
},
},
{
Expand Down Expand Up @@ -345,6 +346,48 @@ module.exports = {
minifyURLs: true,
},
}),
new AutoDllPlugin({
inject: true,
filename: '[name].[hash].js',
entry: {
vendor: [
'bootstrap',
'deep-equal',
'higlass',
'history',
'localforage',
'pixi.js',
'prop-types',
'react',
'react-bootstrap',
'react-dom',
'react-redux',
'react-router',
'react-router-dom',
'react-router-redux',
'redux',
'redux-batched-actions',
'redux-freeze',
'redux-logger',
'redux-persist',
'redux-thunk',
'redux-undo',
],
},
plugins: [
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false,
comparisons: false,
},
output: {
comments: false,
ascii_only: true,
},
sourceMap: false,
}),
],
}),
// Makes some environment variables available to the JS code, for example:
// if (process.env.NODE_ENV === 'production') { ... }. See `./env.js`.
// It is absolutely essential that NODE_ENV was set to production here.
Expand All @@ -366,7 +409,7 @@ module.exports = {
// https://github.com/facebookincubator/create-react-app/issues/2488
ascii_only: true,
},
sourceMap: true,
sourceMap: config.sourceMaps || false,
}),
// Note: this won't work without ExtractTextPlugin.extract(..) in `loaders`.
new ExtractTextPlugin({
Expand Down

0 comments on commit 4d83b1b

Please sign in to comment.