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

Warning for using development build in production #10768

Closed
joker-777 opened this issue Sep 21, 2017 · 5 comments
Closed

Warning for using development build in production #10768

joker-777 opened this issue Sep 21, 2017 · 5 comments

Comments

@joker-777
Copy link

Hi, we are seeing this error

screenshot_20170919_161441

but the React Developer Tools is saying this

reach_notification

We use NODE_ENV=production to build our js file (using browserify) and I also tried out envify but no luck. The red warning doesn't disappear.

@gaearon
Copy link
Collaborator

gaearon commented Sep 21, 2017

Can you point me to a website reproducing this?

@joker-777
Copy link
Author

@gaearon Thanks for the quick reply. Here is an example

https://www.kenhub.com/en/atlas/acromion

@joker-777
Copy link
Author

I had a look at https://fb.me/react-minification and saw your suggestion using certain transformations for browserify

browserify ./index.js \
  -g [ envify --NODE_ENV production ] \
  -g uglifyify \
  -p bundle-collapser/plugin \
  | uglifyjs --compress --mangle > ./bundle.js

our config looked like this (using also NODE_ENV=production when running the gulp command)

  bundler = browserify(config)
  bundler.transform('browserify-shim')
  bundler.transform('coffeeify', {sourceMap: false})

I changed the config like this

  bundler = browserify(config)
  bundler.transform(envify(), {global: true})
  bundler.transform('browserify-shim')
  bundler.transform('coffeeify', {sourceMap: false})
  bundler.plugin('bundle-collapser/plugin')

I tried to use bundler.transform('uglifyify', {global: true}) but got an error. I guess it is related to our use of coffeefy. Could this be the reason? Do I need to use uglifyify?

@ngyikp
Copy link

ngyikp commented Sep 24, 2017

Following the troubleshooting steps at facebook/react-devtools#692, the warning in the console is correct, React is not being minified properly process.env.NODE_ENV isn't turned into a string:

screen shot 2017-09-24 at 11 38 51 am

The reason why the browser icon shows the 'production' icon is because another third-party library you are using (Help Scout) also uses React. If you block https://djtflbt20bdde.cloudfront.net or don't load their library, then the extension correctly detects the 'development build'.

The duplicate React issue is discussed/solved at facebook/react-devtools#700 / facebook/react-devtools#714

@joker-777
Copy link
Author

OK, thanks for investigating. I think we found a solution for us finally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants