var webpack = require('webpack');
var webpackMerge = require('webpack-merge');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var CopyWebpackPlugin = require('copy-webpack-plugin');
const NamedModulesPlugin = require('webpack/lib/NamedModulesPlugin');

var commonConfig = require('./webpack.common.js');
var helpers = require('./helpers');

const ENV = process.env.NODE_ENV = process.env.ENV = 'production';

module.exports = webpackMerge(commonConfig, {
  devtool: 'source-map',

  entry: {
    'app': './src/app/main-ngc.ts'
  },

  output: {
    path: helpers.root('dist'),
    publicPath: '/',
    filename: '[name].[hash].js',
    chunkFilename: '[id].[hash].chunk.js'
  },

  htmlLoader: {
    minimize: false // workaround for ng2
  },

  plugins: [
    new NamedModulesPlugin(),
    new CopyWebpackPlugin([{
      from:  helpers.root('src/public')
    }]),
    new webpack.NoErrorsPlugin(),

    // TODO: Webpack 2 issue https://github.com/webpack/webpack/issues/2644
    // new webpack.optimize.DedupePlugin(),

    new webpack.optimize.UglifyJsPlugin(),
    new ExtractTextPlugin('[name].[hash].css'),
    new webpack.DefinePlugin({
      'process.env': {
        'ENV': JSON.stringify(ENV)
      }
    })
  ]
});

@@ -604,16 +604,17 @@
 cPath: '
+.
 /',%0A    

use relative path