From 25b511f3d522ab28257ffe70758cf8bb643e67cb Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Sat, 10 Sep 2016 14:57:37 +1200 Subject: [PATCH] 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." --- webpack.config.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/webpack.config.js b/webpack.config.js index d6ff67f93..744b2e9d6 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -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,