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

Warn when code is uglified but not envified #1029

Closed
gaearon opened this issue Nov 13, 2015 · 2 comments
Closed

Warn when code is uglified but not envified #1029

gaearon opened this issue Nov 13, 2015 · 2 comments

Comments

@gaearon
Copy link
Contributor

gaearon commented Nov 13, 2015

From my series of tweets:

https://twitter.com/dan_abramov/status/665109454870982656
https://twitter.com/dan_abramov/status/665111615520563200
https://twitter.com/dan_abramov/status/665113061590761472
https://twitter.com/dan_abramov/status/665113349248704512

It's a common problem that people don't know they need to envify CommonJS builds. We need to help educate them about it, both in the docs and in the running code.

In the docs, we need to mention that you need tools like loose-envify (Browserify) or DefinePlugin (Webpack) to set process.env.NODE_ENV to 'production'. Otherwise you're running a slower development-only build of React, Redux, and other libraries.

In the source, we might want to try checking whether a local identifier is crushed. If it is, we're running in minified mode. If we're running in minified mode and process.env.NODE_ENV is something other than 'production', we should console.error, explain the mistake, and point to the relevant doc (a Medium article anyone?) about envifying.

@nettofarah
Copy link

@gaearon what do you mean by checking whether a local identifier is crushed?

@gaearon
Copy link
Contributor Author

gaearon commented Nov 27, 2015

Superseded by #1075.

@gaearon gaearon closed this as completed Nov 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants