const HtmlWebpackPlugin = require('html-webpack-plugin')
const CleanWebpackPlugin = require('clean-webpack-plugin')
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
const CopyWebpackPlugin = require('copy-webpack-plugin')
const path = require('path')


const DIST_DIR = 'public'
const SRC_DIR = 'src'

module.exports = {
  entry: './src/index.js',
  output: {
    publicPath: '/',
    filename: '[name]-[hash].min.js',
    path: path.resolve(__dirname, DIST_DIR),
  },
  plugins: [
    new CleanWebpackPlugin(['public']),
    new HtmlWebpackPlugin({
      template: 'src/_tpl/index.html',
      inject: 'body',
      filename: 'index.html',
    }),
    new BundleAnalyzerPlugin({
      analyzerMode: 'static',
      openAnalyzer: false,
      reportFilename: 'report.html',
    }),
    new CopyWebpackPlugin([
      { from: path.join(SRC_DIR, '/_tpl/favicon.ico'), to: 'favicon.ico' },
      { from: path.join(SRC_DIR, '/_tpl/icon-192x192.png'), to: 'icon-192x192.png' },
      { from: path.join(SRC_DIR, '/_tpl/icon-512x512.png'), to: 'icon-512x512.png' },
      { from: path.join(SRC_DIR, '/_tpl/manifest.json'), to: 'manifest.json' },
    ]),
  ],
  module: {
    rules: [
      {
        test: /\.js$/,
        exclude: /(node_modules|bower_components)/,
        use: {
          loader: 'babel-loader',
          options: {
            presets: ['env'],
          },
        },
      },
    ],
  },
  resolve: {
    extensions: ['.js'],
    modules: [
      './node_modules',
      './src',
    ],
  },
}

@@ -1,12 +1,47 @@
+const webpack = require('webpack')%0A
 const HtmlWe
@@ -393,16 +393,210 @@
   entry:
+ %7B%0A    react: %5B%0A      'react',%0A      'react-dom',%0A      'prop-types',%0A    %5D,%0A    router: 'react-router-dom',%0A    redux: %5B%0A      'redux',%0A      'react-redux',%0A      'redux-thunk',%0A    %5D,%0A    app:
  './src/
@@ -606,16 +606,21 @@
 ex.js',%0A
+  %7D,%0A
   output
@@ -785,16 +785,140 @@
 lic'%5D),%0A
+    new webpack.optimize.CommonsChunkPlugin(%7B%0A      names: %5B'react', 'router', 'redux'%5D,%0A      minChunks: Infinity,%0A    %7D),%0A
     new 

Add simple code splitting using common chunks plugin