webpack.dev.babel.js 1.44 KB
Newer Older
Julien Benchetrit's avatar
Julien Benchetrit committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
/**
 * DEVELOPMENT WEBPACK CONFIGURATION
 */

const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CircularDependencyPlugin = require('circular-dependency-plugin');

module.exports = require('./webpack.base.babel')({
  mode: 'development',

  // Add hot reloading in development
  entry: [
    require.resolve('react-app-polyfill/ie11'),
    'webpack-hot-middleware/client?reload=true',
dengxiaofeng's avatar
dengxiaofeng committed
17
    path.join(process.cwd(), 'src/app.js'), // Start with js/app.js
Julien Benchetrit's avatar
Julien Benchetrit committed
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
  ],

  // Don't use hashes in dev mode for better performance
  output: {
    filename: '[name].js',
    chunkFilename: '[name].chunk.js',
  },

  optimization: {
    splitChunks: {
      chunks: 'all',
    },
  },

  // Add development plugins
  plugins: [
    new webpack.HotModuleReplacementPlugin(), // Tell webpack we want hot reloading
    new HtmlWebpackPlugin({
      inject: true, // Inject all files that are generated by webpack, e.g. bundle.js
dengxiaofeng's avatar
dengxiaofeng committed
37
      template: 'src/index.html',
Julien Benchetrit's avatar
Julien Benchetrit committed
38
    }),
邓晓峰's avatar
邓晓峰 committed
39 40 41 42
    // new CircularDependencyPlugin({
    //   exclude: /a\.js|node_modules/, // exclude node_modules
    //   failOnError: false, // show a warning when there is a circular dependency
    // }),
Julien Benchetrit's avatar
Julien Benchetrit committed
43
  ],
dengxiaofeng's avatar
dengxiaofeng committed
44 45 46 47 48 49 50 51
  devtool: 'cheap-module-source-map',
  node: {
    setImmediate: false,
    process: 'mock',
    dgram: 'empty',
    fs: 'empty',
    net: 'empty',
    tls: 'empty',
张烨's avatar
张烨 committed
52
    child_process: 'empty',
dengxiaofeng's avatar
dengxiaofeng committed
53
  },
Julien Benchetrit's avatar
Julien Benchetrit committed
54 55 56 57
  performance: {
    hints: false,
  },
});