Build React in production mode by default

https://facebook.github.io/react/downloads.html says:
"By default, React will be in development mode. To use React in production mode, set the environment variable NODE_ENV to production (using envify or webpack's DefinePlugin). A minifier that performs dead-code elimination such as UglifyJS is recommended to completely remove the extra code present in development mode."
This commit is contained in:
Ingo Schommer 2016-09-10 14:57:37 +12:00
parent 9cb9a05ec0
commit 25b511f3d5

View File

@ -148,6 +148,12 @@ const config = [
jQuery: 'jQuery',
$: 'jQuery',
}),
new webpack.DefinePlugin({
'process.env':{
// Builds React in production mode, avoiding console warnings
'NODE_ENV': JSON.stringify('production')
}
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
unused: false,