import webpack from 'webpack'
import getBaseConfig from './webpack.config'

export default config => {
  const baseConfig = getBaseConfig(Object.assign({}, config, {env: 'production'}))
  const skipMinify = config.skipMinify

  return Object.assign({}, baseConfig, {
    devtool: config.sourceMaps ? 'source-map' : undefined,
    plugins: (baseConfig.plugins || []).concat([
      new webpack.DefinePlugin({
        'process.env': {
          NODE_ENV: JSON.stringify('production')
        }
      }),
      !skipMinify && new webpack.optimize.UglifyJsPlugin({
        compressor: {
          warnings: false
        }
      })
    ].filter(Boolean))
  })
}

import webpack from 'webpack'
import getBaseConfig from './webpack.config'

export default config => {
  const baseConfig = getBaseConfig(Object.assign({}, config, {env: 'production'}))

  return Object.assign({}, baseConfig, {
    devtool: config.sourceMaps ? 'source-map' : undefined,
    plugins: (baseConfig.plugins || []).concat([
      new webpack.DefinePlugin({
        'process.env': {
          NODE_ENV: JSON.stringify('production')
        }
      })
    ].filter(Boolean))
  })
}

Move minification out of webpack
Move minification out of webpack
