const env = process.env.NODE_ENV;
const live = (env === 'production' || env === 'staging');
const AssetsPlugin = require('assets-webpack-plugin');
const assetsPluginInstance = new AssetsPlugin();
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CompressionPlugin = require('compression-webpack-plugin');
console.log('in prod: ', live);
const webpack = require('webpack');
const path = require('path');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = {
  context: `${__dirname}/app`,
  entry: {
    javascript: './app.jsx',
  },
  output: {
    filename: '[name].[hash].js',
    chunkFilename: '[name].[chunkhash].js',
    path: `${__dirname}/dist`,
  },
  plugins: [
    assetsPluginInstance,
    new ExtractTextPlugin('style.css'),
    new webpack.DefinePlugin({
      'process.env.NODE_ENV': JSON.stringify(env || 'development'),
      'process.env.EMPIRICAL_BASE_URL': JSON.stringify(process.env.EMPIRICAL_BASE_URL || 'http://localhost:3000'),
      'process.env.QUILL_CMS': JSON.stringify(process.env.QUILL_CMS || 'http://localhost:3100'),
    }),
    new CompressionPlugin({
      asset: '[path].gz[query]',
      algorithm: 'gzip',
      test: /\.js$/,
      threshold: 10240,
      minRatio: 0.8,
    }),
    new HtmlWebpackPlugin({
      template: './index.html.ejs',
      inject: 'body',
    })
  ],
  module: {
    noParse: /node_modules\/json-schema\/lib\/validate\.js/,
    loaders: [
      {
        test: /\.jsx?$/,
        exclude: /node_modules/,
        loaders: ['react-hot-loader', 'babel-loader'],
      },
      {
        test: /\.jsx?$/,
        exclude: /node_modules/,
        loader: 'babel-loader',
        query:
        {
          presets: ['es2015', 'react'],
        },
      },
      {
        test: /\.html$/,
        loader: 'file-loader?name=[name].[ext]',
      },
      {
        test: /\.scss$/,
        loader: live ? ExtractTextPlugin.extract('css-loader?sourceMap!sass-loader?sourceMap') : 'style-loader!css-loader?sourceMap!sass-loader?sourceMap',
      },
      {
        test: /\.svg$/,
        loader: 'file-loader',
        include: /app\/img/,
      },
      {
        test: /\.(jpg|png)$/,
        loader: 'url-loader?limit=25000',
        include: /app\/img/,
      },
      { test: /\.json$/, loader: 'json-loader', }
    ],
  },
  node: {
    console: true,
    fs: 'empty',
    net: 'empty',
    tls: 'empty',
  },

};

@@ -1426,30 +1426,28 @@
 e%5C.js/,%0A    
-loader
+rule
 s: %5B%0A      %7B
@@ -1517,18 +1517,25 @@
     
-loaders: %5B
+use: %5B%0A          
 'rea
@@ -1549,16 +1549,26 @@
 loader',
+%0A         
  'babel-
@@ -1574,16 +1574,25 @@
 -loader'
+%0A        
 %5D,%0A     
@@ -1701,21 +1701,23 @@
         
-query
+options
 :%0A      
@@ -1817,32 +1817,30 @@
 $/,%0A        
-loader
+use
 : 
+%5B
 'file-loader
@@ -1858,16 +1858,17 @@
 %5D.%5Bext%5D'
+%5D
 ,%0A      
@@ -1911,22 +1911,19 @@
         
-loader
+use
 : live ?
@@ -1923,16 +1923,17 @@
  live ? 
+%5B
 ExtractT
@@ -1999,11 +1999,13 @@
 ap')
+%5D
  : 
+%5B
 'sty
@@ -2013,17 +2013,20 @@
 e-loader
-!
+', '
 css-load
@@ -2029,33 +2029,36 @@
 loader?sourceMap
-!
+', '
 sass-loader?sour
@@ -2063,16 +2063,17 @@
 urceMap'
+%5D
 ,%0A      
@@ -2296,59 +2296,8 @@
    %7D
-,%0A      %7B test: /%5C.json$/, loader: 'json-loader', %7D
 %0A   

Update loader confif