text: const webpack = require('webpack');
  const webpackMerge = require('webpack-merge');
  const ExtractTextPlugin = require('extract-text-webpack-plugin');
  const DefinePlugin = require('webpack/lib/DefinePlugin');
  const commonConfig = require('./webpack.common.js');
  const helpers = require('./helpers');
  
  const ENV = process.env.NODE_ENV = process.env.ENV = 'production';
  const HOST = process.env.HOST || 'localhost';
  const PORT = process.env.PORT || 8080;
  const METADATA = webpackMerge(commonConfig({env: ENV}).metadata, {
    host: HOST,
    port: PORT,
    ENV: ENV,
    HMR: false
  });
  
  module.exports = webpackMerge(commonConfig({env: ENV}), {
    devtool: 'source-map',
  
    output: {
      path: helpers.root('dist', 'client'),
      publicPath: '/',
      filename: '[name].[hash].js',
      chunkFilename: '[id].[hash].chunk.js'
    },
  
    htmlLoader: {
      minimize: false // workaround for ng2
    },
  
    plugins: [
      new webpack.NoErrorsPlugin(),
      new webpack.optimize.DedupePlugin(),
      new webpack.optimize.UglifyJsPlugin({ // https://github.com/angular/angular/issues/10618
        mangle: {
          keep_fnames: true
        },
        compress: {
          warnings: false
        }
      }),
      new ExtractTextPlugin('[name].[hash].css'),
      new DefinePlugin({
        'ENV': JSON.stringify(METADATA.ENV),
        'process.env': {
          'ENV': JSON.stringify(METADATA.ENV),
          'NODE_ENV': JSON.stringify(METADATA.ENV),
        }
      }),
    ]
  });
  