Disable warning about minified copy of the development build
Hello. Since upgrading to v15 I get this all over the place in my unit tests:
Warning: It looks like you're using a minified copy of the development build of React. When deploying React apps to production, make sure to use the production build which skips development warnings and is faster. See https://fb.me/react-minification for more details.
This warning makes sense in prod but in my case, my toolchain is a little different; I use React with Scala and build a special test-deps.js containing all external JS required by unit tests. Minimising it means it loads faster and so I end up with a valid case for a minimisation of the React dev.
Is there a way to remove this warning? It appears a heap of times as my tests are concurrent.
Is there a way to remove this warning?
Currently, no. One of the things that's somewhere on the roadmap is to make it easier to opt-in/out of specific warnings but there hasn't been a lot of motion on that. Maybe there's something we can do specifically for that warning though...
@zpao i have this warning with NODE_ENV=production
if use webpack,add those code when deploy
new webpack.DefinePlugin({
"process.env": {
NODE_ENV: JSON.stringify("production")
}
})
@nodeman777 I've add that code in webpack plugins, but the warning still exit.
The issue reported here is specifically about minifying non-production React. If you have problems with your toolchain creating a production build, that's a distinct issue and should be discussed in a new issue (or stack overflow first, as this is not intended to be a support forum).
In general, if you are minifying your code on staging to simulate a production environment, you should probably be running the production copy of React just in case there are any subtle differences in the code paths (there shouldn't be, if we did everything right, but you never know and it's that type of bug that can really bite you).
Yep, I agree, but we using NODE_ENV to set environment for app and this describe for app what endpoints/databases/credentials to use in this environment. What is why we need staging. And I think it is not good to use some another environment variable for app to fix warning with react
Oh I have just got this warning !
@japgolly : changed the title from Disable minified copy of the development build to Disable warning about minified copy of the development build ?
see here .
@vimniky After I read your article , I solved the warning .
@vimniky Just found you article before and I confirm too that the warning is gone. Thank you!
I'm getting this warning with NODE_ENV=development, where it doesn't make any sense. We're not even using minification; we use Browserify to build the app bundle on demand.
if you do uglify or any things that minify your code in your webpack config in development mode this warning will be showed for me i have to remove new webpack.optimize.UglifyJsPlugin({mangle: false, compress: {warnings: false}}), in my webpack development config to get rid of this warning
This issue was happening to me when running uglify-js with --compress and/or --mangle params.
I am getting this error in NODE_ENV=development, too Is this a bug?
i add this "new webpack.DefinePlugin({ "process.env": { NODE_ENV: JSON.stringify("production") } })",but still show Warning: It looks like you're using a minified copy of the development build of React. When deploying React apps to production, make sure to use the production build which skips development warnings and is faster. See https://fb.me/react-minification for more details.
can anyone tell me how to resolve this problem?
Also getting this message in production despite env-ifying
I keep getting this even if I added this:
new webpack.DefinePlugin({ 'process.env': { 'NODE_ENV': JSON.stringify('production') } })
then run this: "build": "cross-env NODE_ENV=production webpack --progress --colors -p"
even if I run just webpack -p with DefinePlugin settings, still im getting the warning.
I found that passing -p to webpack fixes this error. Is webpack no longer looking at NODE_ENV?
We don’t plan to relax the warning. If you see it there is a problem in your build. You’re shipping a lot of unnecessary code to your users, and React is also slower in development mode.
We have instructions for all popular bundlers. If you are still having problems, please provide a project and somebody might help you out in this thread.
Cheers!