text: require('babel-polyfill');
  
  // Webpack config for creating the production bundle.
  var path = require('path');
  var webpack = require('webpack');
  var CleanPlugin = require('clean-webpack-plugin');
  var ExtractTextPlugin = require('extract-text-webpack-plugin');
  var strip = require('strip-loader');
  
  var projectRootPath = path.resolve(__dirname, '../');
  var assetsPath = path.resolve(projectRootPath, './static/dist');
  
  // https://github.com/halt-hammerzeit/webpack-isomorphic-tools
  var WebpackIsomorphicToolsPlugin = require('webpack-isomorphic-tools/plugin');
  var webpackIsomorphicToolsPlugin = new WebpackIsomorphicToolsPlugin(require('./webpack-isomorphic-tools'));
  var CopyWebpackPlugin = require('copy-webpack-plugin');
  
  module.exports = {
    devtool: 'source-map',
    context: path.resolve(__dirname, '..'),
    entry: {
      'main': [
        './src/client.js'
      ]
    },
    output: {
      path: assetsPath,
      filename: '[name]-[chunkhash].js',
      chunkFilename: '[name]-[chunkhash].js',
      publicPath: '/dist/'
    },
    module: {
      loaders: [
        { test: /\.css$/, loader: ExtractTextPlugin.extract('style', 'css?modules&importLoaders=2&sourceMap!autoprefixer?browsers=last 2 version')},
        { test: /\.jsx?$/, exclude: /node_modules/, loaders: [strip.loader('debug'), 'babel']},
        { test: /\.json$/, loader: 'json-loader' },
        { test: /\.less$/, loader: ExtractTextPlugin.extract('style', 'css?modules&importLoaders=2&sourceMap!autoprefixer?browsers=last 2 version!less?outputStyle=expanded&sourceMap=true&sourceMapContents=true') },
        { test: /\.scss$/, loader: ExtractTextPlugin.extract('style', 'css?modules&importLoaders=2&sourceMap!autoprefixer?browsers=last 2 version!sass?outputStyle=expanded&sourceMap=true&sourceMapContents=true') },
        { test: /\.woff(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=application/font-woff" },
        { test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=application/font-woff" },
        { test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=application/octet-stream" },
        { test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: "file" },
        { test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=image/svg+xml" },
        { test: webpackIsomorphicToolsPlugin.regular_expression('images'), loader: 'url-loader?limit=10240' },
      ],
    },
    progress: true,
    resolve: {
      modulesDirectories: [
        'src',
        'node_modules',
        'node_modules/antd/node_modules'
      ],
      extensions: ['', '.json', '.js', '.jsx']
    },
    plugins: [
      new CleanPlugin([assetsPath], { root: projectRootPath }),
      new CopyWebpackPlugin([
        { from: 'node_modules/antd/dist/*', flatten: true, force: true },
        { from: 'node_modules/antd/dist/*.css.map', flatten: true, force: true }
      ]),
  
      // css files from the extract-text-plugin loader
      new ExtractTextPlugin('[name]-[chunkhash].css', {allChunks: true}),
      new webpack.DefinePlugin({
        'process.env': {
          NODE_ENV: '"production"'
        },
  
        __CLIENT__: true,
        __SERVER__: false,
        __DEVELOPMENT__: false,
        __DEVTOOLS__: false
      }),
  
      // ignore dev config
      new webpack.IgnorePlugin(/\.\/dev/, /\/config$/),
  
      // optimizations
      new webpack.optimize.DedupePlugin(),
      new webpack.optimize.OccurenceOrderPlugin(),
      new webpack.optimize.UglifyJsPlugin({
        compress: {
          warnings: false
        }
      }),
  
      webpackIsomorphicToolsPlugin
    ]
  };
  