From 37330783517560aa785589c2d659525d4b2020a0 Mon Sep 17 00:00:00 2001 From: Ivan Akulov Date: Thu, 18 Jan 2018 18:46:24 +0300 Subject: [PATCH] Extract the vendor and the runtime code --- webpack.config.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/webpack.config.js b/webpack.config.js index 78110d8..aaf9388 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -20,10 +20,12 @@ const isProduction = process.env.NODE_ENV === 'production'; module.exports = { mode: isProduction ? 'production' : 'development', - entry: './src/index.js', + entry: { + main: './src/index.js', + }, output: { path: path.resolve(__dirname, 'public', 'build'), - filename: isProduction ? 'bundle.[chunkhash].js' : 'bundle.js', + filename: isProduction ? '[name].[chunkhash].js' : '[name].js', publicPath: '/build/', }, module: { @@ -55,6 +57,12 @@ module.exports = { }, ], }, + optimization: { + splitChunks: { + chunks: 'all', + }, + runtimeChunk: true, + }, plugins: [ // Emit HTML files that serve the app new HtmlWebpackPlugin({