From a3d70dd79f179919abb48257df7277ec8227122b Mon Sep 17 00:00:00 2001 From: Justin Gordon Date: Sun, 25 Oct 2015 12:19:24 -0700 Subject: [PATCH] Update webpack.client.base.config.js --- client/webpack.client.base.config.js | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/client/webpack.client.base.config.js b/client/webpack.client.base.config.js index 186d186a6..2c3cec3ee 100644 --- a/client/webpack.client.base.config.js +++ b/client/webpack.client.base.config.js @@ -7,20 +7,35 @@ module.exports = { // the project dir context: __dirname, entry: { + + // See use of 'vendor' in the CommonsChunkPlugin inclusion below. vendor: [ + 'babel-core/polyfill', 'jquery', 'jquery-ujs', + 'react', + 'react-dom', ], - app: ['babel-core/polyfill'], + + // This will contain the app entry points defined by webpack.hot.config and webpack.rails.config + app: [], }, resolve: { extensions: ['', '.webpack.js', '.web.js', '.js', '.jsx', '.scss', '.css', 'config.js'], }, plugins: [ + + // https://webpack.github.io/docs/list-of-plugins.html#2-explicit-vendor-chunk new webpack.optimize.CommonsChunkPlugin({ + + // This name 'vendor' ties into the entry definition name: 'vendor', - chunks: ['app'], + + // We don't want the default vendor.js name filename: 'vendor-bundle.js', + + // Passing Infinity just creates the commons chunk, but moves no modules into it. + // In other words, we only put what's in the vendor entry definition in vendor-bundle.js minChunks: Infinity, }), ],