import webpack from 'webpack';
import path from 'path';

const GLOBALS = {
  'process.env.NODE_ENV': JSON.stringify('production'),
  __DEV__: false,
  'process.env.ENDPOINT': JSON.stringify('https://learn-react-newsfeed.herokuapp.com/api'),
};

export default {
  debug: true,
  devtool: 'source-map',
  noInfo: true,
  entry: './src/index',
  target: 'web',
  output: {
    path: path.join(__dirname, '..', 'dist'),
    publicPath: '/',
    filename: 'bundle.js',
  },
  plugins: [
    new webpack.LoaderOptionsPlugin({
      minimize: true,
      debug: false,
    }),
    new webpack.optimize.UglifyJsPlugin({
      compress: {
        warnings: false,
      },
      output: {
        comments: false,
      },
      sourceMap: false,
    }),
    new webpack.DefinePlugin(GLOBALS),
  ],
  module: {
    loaders: [{
      test: /\.(js)$/,
      exclude: /node_modules/,
      loaders: [
        'babel-loader',
      ],
    },
    // TODO: fix any webpack 2 stuff below
    {
      test: /(\.css|\.scss)$/,
      loaders: ['style', 'css?sourceMap', 'sass?sourceMap'],
    }, {
      test: /\.(jpe?g|png|gif)$/i,
      loaders: ['file'],
    }, {
      test: /\.ico$/,
      loader: 'file-loader?name=[name].[ext]',
    }, {
      test: /(\.css|\.scss)$/,
      include: path.join(__dirname, 'src'),
    }],
  },
};

@@ -916,16 +916,163 @@
      %5D,%0A
+      query: %7B%0A        presets: %5B'es2015',%0A                'react',%0A                'stage-0',%0A                'es2015-native-modules',%5D,%0A      %7D,%0A
     %7D,%0A 

add presets to react, trying to fix annoying bug