I receive this errors from react and redux when I tried to deploy my test app. But these errors don't appear on my local machine.
But then I realized that my local machine is not using the minified version of the bundle (but my deployed app is using the minified version), so I minified the bundle, then boom! the errors appeared. Any idea why this happens and how it can be fixed?
Thanks in advance for those who would help.
Okay I get it.
So when minified, react is looking for the process.env.NODE_ENV
and checking whether it is set to production
. there are two solutions for this:
Solution one
The easiest way of doing this (if you're using webpack, which is, I am) is to run webpack --define process.env.NODE_ENV='\"production\"'
which will take care of it for you.
Solution two
is to add these on your plugins in your webpack.config.js
file.
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('production')
}
})