/**
 * Created by v0n000p on 2/19/17.
 */

const UglifyJsPlugin = require('uglifyjs-webpack-plugin');

const path = require('path');
const webpack = require('webpack');
const isProduction = process.env.NODE_ENV === 'production';

console.log('isProduction', isProduction);

const plugins = [];
const optimization = {};
const rules = [{ test: /\.tsx?$/, loader: 'ts-loader' }];

if (isProduction) {
  optimization.minimizer = [new UglifyJsPlugin()];
}

module.exports = {
  entry: path.resolve(__dirname, './src/containers/index.ts'),
  output: {
    path: path.resolve(__dirname, './dist'),
    filename: '[name].js',
  },
  resolve: {
    // Add `.ts` and `.tsx` as a resolvable extension.
    extensions: ['.ts', '.tsx', '.js'], // note if using webpack 1 you'd also need a '' in the array as well
  },
  module: {
    rules: rules,
  },
  optimization: optimization,
  plugins: plugins,
};

@@ -315,66 +315,8 @@
  %7B%7D;
-%0Aconst rules = %5B%7B test: /%5C.tsx?$/, loader: 'ts-loader' %7D%5D;
 %0A%0Aif
@@ -763,21 +763,182 @@
  rules: 
-rules
+%5B%0A      %7B%0A        test: /%5C.tsx?$/,%0A        exclude: /node_modules/,%0A        use: %5B%0A          %7B%0A            loader: 'ts-loader',%0A          %7D,%0A        %5D,%0A      %7D,%0A    %5D
 ,%0A  %7D,%0A 

improve webpack config to fix #12