text: import webpack from 'webpack';
  import HtmlWebpackPlugin from 'html-webpack-plugin';
  import path from 'path';
  import Dotenv from 'dotenv-webpack';
  
  const GLOBALS = {
    'process.env.NODE_ENV': JSON.stringify('development'),
    'process.env.BROWSER': true,
    __DEV__: true
  };
  
  export default {
    resolve: {
      extensions: ['*', '.js', '.jsx', '.json'],
    },
    devtool: 'eval-source-map',
    entry: [
      'babel-polyfill',
      'react-hot-loader/patch',
      './src/webpack-public-path',
      'webpack-hot-middleware/client?reload=true',
      path.resolve(__dirname, '../src/index.js')
    ],
    target: 'web',
    mode: 'development',
    output: {
      path: path.resolve(__dirname, '../dist'),
      publicPath: '/',
      filename: 'bundle.js'
    },
    plugins: [
      new webpack.DefinePlugin(GLOBALS),
      new webpack.HotModuleReplacementPlugin(),
      new webpack.NamedModulesPlugin(),
      new webpack.NoEmitOnErrorsPlugin(),
      new HtmlWebpackPlugin({
        template: 'src/index.ejs',
        minify: {
          removeComments: true,
          collapseWhitespace: true
        },
        inject: true
      }),
      new Dotenv({
        path: path.resolve(__dirname, `../.env.${process.env.ENV || 'dev'}`),
        systemvars: true,
      })
    ],
    module: {
      rules: [
        {
          test: /\.jsx?$/,
          exclude: /node_modules/,
          loader: 'babel-loader',
          options: {
            cacheDirectory: true,
            babelrc: false,
            presets: [['env', { modules: false }], 'react', 'stage-0'],
            plugins: ['react-hot-loader/babel'],
          }
        },
        { test: /\.eot(\?v=\d+.\d+.\d+)?$/, loader: 'file-loader' },
        { test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: 'url-loader?limit=10000&mimetype=application/font-woff' },
        { test: /\.[ot]tf(\?v=\d+.\d+.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/octet-stream' },
        { test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=image/svg+xml' },
        { test: /\.(jpe?g|png|gif)$/i, loader: 'file-loader?name=[name].[ext]' },
        { test: /\.ico$/, loader: 'file-loader?name=[name].[ext]' },
        {
          test: /(\.css|\.scss)$/,
          use: [
            'style-loader',
            {
              loader: 'css-loader',
              options: {
                sourceMap: true
              }
            }, {
              loader: 'postcss-loader',
              options: {
                plugins: () => [
                  require('autoprefixer')
                ],
                sourceMap: true
              }
            }, {
              loader: 'sass-loader',
              options: {
                includePaths: [path.resolve(__dirname, '../src', 'scss')],
                sourceMap: true
              }
            }
          ]
        }
      ]
    }
  };
  