text: const path = require('path');
  const merge = require('webpack-merge');
  const webpack = require('webpack');
  const ExtractTextPlugin = require('extract-text-webpack-plugin');
  const CopyWebpackPlugin = require('copy-webpack-plugin');
  const config = require('./webpack.config.base');
  
  const GLOBALS = {
    'process.env': {
      'NODE_ENV': JSON.stringify('production')
    },
    __DEV__: JSON.stringify(JSON.parse(process.env.DEBUG || 'false'))
  };
  
  module.exports = merge(config, {
    debug: false,
    devtool: 'cheap-module-source-map',
    entry: {
      application: 'production',
      vendor: ['react', 'react-dom', 'react-redux', 'react-router', 'react-router-redux', 'redux']
    },
    plugins: [
      new CopyWebpackPlugin([
        {
          from: path.join(__dirname, '../src/client/assets/images'),
          to: 'images'
        },
      ]),
      // Avoid publishing files when compilation fails
      new webpack.NoErrorsPlugin(),
      new webpack.DefinePlugin(GLOBALS),
      new webpack.optimize.DedupePlugin(),
      new webpack.optimize.UglifyJsPlugin({
        compress: {
          warnings: false,
          'screw_ie8': true
        },
        output: {
          comments: false
        },
        sourceMap: false
      }),
      new webpack.LoaderOptionsPlugin({
        minimize: true,
        debug: false
      }),
      new ExtractTextPlugin({
        filename: 'css/app.css',
        allChunks: true
      }),
      new webpack.ProvidePlugin({
        'Promise': 'es6-promise', // Thanks Aaron (https://gist.github.com/Couto/b29676dd1ab8714a818f#gistcomment-1584602)
        'fetch': 'imports?this=>global!exports?global.fetch!whatwg-fetch'
      })
    ],
    module: {
      noParse: /\.min\.js$/,
      loaders: [
        // Sass
        {
          test: /\.scss$/,
          include: [
            path.resolve(__dirname, '../src/client/assets/javascripts'),
            path.resolve(__dirname, '../src/client/assets/styles'),
            path.resolve(__dirname, '../src/client/scripts')
          ],
          loader: ExtractTextPlugin.extract({
            fallbackLoader: 'style',
            loader: [
              { loader: 'css', query: { sourceMap: true } },
              'postcss',
              { loader: 'sass', query: { outputStyle: 'compressed' } }
            ]
          })
        },
        // Sass + CSS Modules
        // {
        //   test: /\.scss$/,
        //   include: /src\/client\/assets\/javascripts/,
        //   loader: ExtractTextPlugin.extract({
        //     fallbackLoader: 'style',
        //     loader: [
        //       {
        //         loader: 'css',
        //         query: {
        //           modules: true,
        //           importLoaders: 1,
        //           localIdentName: '[path][name]__[local]--[hash:base64:5]'
        //         }
        //       },
        //       'postcss',
        //       { loader: 'sass', query: { outputStyle: 'compressed' } }
        //     ]
        //   })
        // },
        // CSS
        {
          test: /\.css$/,
          loader: ExtractTextPlugin.extract({
            fallbackLoader: 'style',
            loader: ['css', 'postcss']
          })
        }
      ]
    },
  });
  