Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React DevTools Chrome extension warns that React is in development mode even when NODE_ENV=production #1975

Closed
nfriedly opened this issue May 16, 2017 · 7 comments
Assignees

Comments

@nfriedly
Copy link

nfriedly commented May 16, 2017

I'm not sure what the root cause is here, but when I view my site in Chrome, the React DevTools extension warns that it's in development mode.

I have:

  • NODE_ENV=production in my npm start script
  • I check process.env.NODE_ENV in my express server.js script and set dev to false for next({ dev })
  • I tried setting NODE_ENV=production for the build script, but it didn't seem to make any difference.

Am I missing anything?

My code is at https://github.com/nfriedly/user-agent.io if you'd like to take a look. I get the same warning both locally and when running on Bluemix.

@arunoda
Copy link
Contributor

arunoda commented May 16, 2017

Have you build your app with "next build"

@nfriedly
Copy link
Author

nfriedly commented May 16, 2017

Yep, I tried next build and NODE_ENV=production next build

@arunoda
Copy link
Contributor

arunoda commented May 16, 2017

I would like to have a look at this.

@arunoda arunoda self-assigned this May 16, 2017
@nfriedly
Copy link
Author

nfriedly commented May 16, 2017

Thanks, I'd appreciate that. I've tried everything I could think of, right down to inspecting the minified JS (although, I'm not really sure what's different about prod vs dev react, so I wasn't entirely sure what to look for...)

FWIW, there are a couple of places in the minified JS where it checks t.env.NODE_ENV === "production", and in those cases, t looks like:

{
	"title": "browser",
	"browser": true,
	"env": {},
	"argv": [],
	"version": "",
	"versions": {}
}

(Presumably t was process before minification.)

@arunoda
Copy link
Contributor

arunoda commented May 16, 2017

This is a result of the react-google-ad component.
It comes with a it's own copy of React.

Try to use something else for that.

@arunoda arunoda closed this as completed May 16, 2017
@nfriedly
Copy link
Author

Oh, gosh. Thank you!

And, I'm sorry for wasting your time on something that really had nothing to do with you...

@arunoda
Copy link
Contributor

arunoda commented May 16, 2017

No problem. I was a good learning experience.

@lock lock bot locked as resolved and limited conversation to collaborators May 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants