import path from 'path';

import HtmlWebpackPlugin from 'html-webpack-plugin';
import ExtractTextPlugin from 'extract-text-webpack-plugin';

module.exports = {
  context: path.resolve(__dirname, 'src'),
  entry: 'app.js',
  output: {
    path: path.resolve(__dirname, 'build'),
    filename: 'bundle.js'
  },
  devtool: 'source-map',
  devServer: {
    historyApiFallback: true,

    // Enables automatic reloading when files are changed.
    //
    // As of February 10, 2017, Webpack's docs mention that: "By default the
    // application will be served with inline mode enabled." This doesn't seem
    // to be the case, as without the inline option specified, there is no auto
    // reloading.
    //
    // Reference: https://webpack.js.org/configuration/dev-server/#devserver-inline-cli-only
    inline: true
  },
  resolve: {
    modules: [
      path.resolve(__dirname, 'src'),
      path.resolve(__dirname, 'node_modules')
    ],
    extensions: [
      '.js', '.json', // Defaults
      '.jsx'
    ]
  },
  module: {
    rules: [
      {
        test: /\.jsx?$/, // Match both .js and .jsx.
        exclude: /node_modules/,
        use: 'babel-loader'
      },
      {
        test: /\.scss$/,
        loader: ExtractTextPlugin.extract({
          fallback: 'style-loader',
          loader: [ 'css-loader', 'sass-loader' ]
        })
      },
      {
        test: /\.(png|jpg|ico)/,
        use: 'url-loader?limit=10000'
      }
    ]
  },
  plugins: [
    new HtmlWebpackPlugin({
      favicon: 'img/favicon.ico',
      template: 'index.html',
    }),

    new ExtractTextPlugin('style.css')
  ]
};

@@ -19,16 +19,47 @@
 path';%0A%0A
+import webpack from 'webpack';%0A
 import H
@@ -103,16 +103,16 @@
 lugin';%0A
-
 import E
@@ -240,16 +240,96 @@
 ry: 
-'app.js'
+%7B%0A    main: 'app.js',%0A    vendor: %5B 'react', 'react-dom', 'react-router', 'moment' %5D%0A  %7D
 ,%0A  
@@ -401,14 +401,26 @@
 e: '
-bundle
+%5Bchunkhash%5D.%5Bname%5D
 .js'
@@ -1722,16 +1722,92 @@
 le.css')
+,%0A%0A    new webpack.optimize.CommonsChunkPlugin(%7B%0A      name: 'vendor'%0A    %7D)
 %0A  %5D%0A%7D;%0A

Split vendor libraries from our app