var path = require('path');
var webpack = require('webpack');

module.exports = {
  context: __dirname + "/src",
  entry: "./jsx/main.jsx",
  output: {
    path: path.join(__dirname, 'build'),
    filename: 'js/app.js'
  },
  resolve: {
    extensions: ['', '.js', '.jsx'],
    modulesDirectories: ["src/jsx", "node_modules"]
  },
  module: {
    loaders: [
      {
        exclude: /node_modules/,
        test: /\.jsx?$/,
        loader: "babel-loader",
        query: {
          cacheDirectory: true,
          presets: ['es2015', 'react']
        }
      },
      {
        test: /\.jpe?g$|\.gif$|\.png$|\.svg$|\.woff$|\.ttf$|\.wav$|\.mp3$/,
        loader: "file"
      },
      {
        test: /\.html$/,
        loader: "file?name=[name].[ext]",
      },
      {
        test: /\.sass$/,
        loaders: ["style", "css", "sass?indentedSyntax"]
      }
    ]
  },
  // context: path.join(__dirname, 'build'),
  plugins: [
    new webpack.EnvironmentPlugin('NODE_ENV')
  ]
};
var path = require('path');

module.exports = {
  context: __dirname + "/src",
  entry: "./jsx/main.jsx",
  output: {
    path: path.join(__dirname, 'build'),
    filename: 'js/app.js'
  },
  resolve: {
    extensions: ['', '.js', '.jsx'],
    modulesDirectories: ["src/jsx", "node_modules"]
  },
  module: {
    loaders: [
      {
        exclude: /node_modules/,
        test: /\.jsx?$/,
        loader: "babel-loader",
        query: {
          cacheDirectory: true,
          presets: ['es2015', 'react']
        }
      },
      {
        test: /\.jpe?g$|\.gif$|\.png$|\.svg$|\.woff$|\.ttf$|\.wav$|\.mp3$/,
        loader: "file"
      },
      {
        test: /\.html$/,
        loader: "file?name=[name].[ext]",
      },
      {
        test: /\.sass$/,
        loaders: ["style", "css", "sass?indentedSyntax"]
      }
    ]
  },
  // context: path.join(__dirname, 'build'),
  plugins: [
  ]
};
--- 
+++ 
@@ -1,4 +1,5 @@
 var path = require('path');
+var webpack = require('webpack');
 
 module.exports = {
   context: __dirname + "/src",
@@ -38,5 +39,6 @@
   },
   // context: path.join(__dirname, 'build'),
   plugins: [
+    new webpack.EnvironmentPlugin('NODE_ENV')
   ]
 };
Optimize production builds by passing in NODE_ENV

React contains a lot of debugging machinery that is being run throughout
development. This should always be stripped out in production in order
to make the application more performant. The most simple way to do this
is with the built-in Webpack EnvironmentPlugin that will make the
environment variables given available to the script and make React strip
out debugging calls when NODE_ENV is not set to “development”.

There is a more advanced way of achieving the same with the
DefinePlugin, but this power is not needed here. The DefinePlugin has
the added benefit of allowing you to define your own “globals” and make
use of them in the script.

    new webpack.DefinePlugin({
      '__DEV__': JSON.stringify(false),
      '__MY_OTHER_GLOBAL__': 'A nice value',
      'process.env.NODE_ENV': JSON.stringify('production')
    })
