import webpack from 'webpack'; import config from './webpack.config'; import { mapObject } from './web/util/util'; export const original = config; /** * Development config. Inspired by * https://github.com/gaearon/react-transform-boilerplate/blob/master/webpack.config.dev.js */ export const development = { ...config, debug: true, devtool: 'source-map', entry: mapObject(config.entry, ([ name, sources ]) => { const newSources = [ 'eventsource-polyfill', // necessary for hot reloading with IE 'webpack-hot-middleware/client', ...sources, ]; return [ name, newSources ]; }), output: { ...config.output, pathinfo: true, }, plugins: [ ...(config.plugins || []), new webpack.HotModuleReplacementPlugin(), new webpack.NoErrorsPlugin(), ], }; /** * Production config. Inspired by * https://github.com/gaearon/react-transform-boilerplate/blob/master/webpack.config.prod.js */ export const production = { ...config, plugins: [ ...(config.plugins || []), new webpack.optimize.OccurenceOrderPlugin(), new webpack.DefinePlugin({ 'process.env': { NODE_ENV: JSON.stringify('production'), }, }), new webpack.optimize.UglifyJsPlugin({ compressor: { warnings: false, }, }), ], };