score:12

Accepted answer

your application's process.env.node_env variable needs to be set to production within webpack's build script. react's optimizing performance documentation instructs webpack users to do this using webpack's defineplugin.

new webpack.defineplugin({
  'process.env.node_env': json.stringify('production')
})

while it seems that the -p option should set process.env.node_env to production, there is a caveat explained in webpack's specifying the environment documentation that this is not set withtin webpack's build script (for what its worth, many developers have reported this as an issue).


Related Query

More Query from same tag