Skip to content

Instantly share code, notes, and snippets.

@joewalker
Created February 29, 2016 16:46
Show Gist options
  • Save joewalker/ad6eb9363d0c3615f473 to your computer and use it in GitHub Desktop.
Save joewalker/ad6eb9363d0c3615f473 to your computer and use it in GitHub Desktop.
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.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('development'),
},
}),
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,
},
}),
],
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment