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

Adds process.env.NODE_ENV polyfill #2279

Closed
wants to merge 1 commit into from

Conversation

dsibiski
Copy link
Contributor

There are many libraries that use NODE_ENV to check whether the code is running in
"production" mode or not. This allows those library authors to not have to add conditionals
for React Native.

One such library is Redux: reduxjs/react-redux#40

Thanks to @brentvatne for providing the solution via this tweet (via his phone in the airport 😉): https://twitter.com/notbrent/status/630440250951749632

/cc @vjeux @gaearon @zpao @amasad

There are many libraries that use `NODE_ENV` to check whether the code is running in
"production" mode or not. This allows those library authors to not have to add conditionals
for React Native.
@facebook-github-bot facebook-github-bot added GH Review: review-needed CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. labels Aug 10, 2015
@vjeux
Copy link
Contributor

vjeux commented Aug 10, 2015

@facebook-github-bot import

@vjeux vjeux self-assigned this Aug 10, 2015
@facebook-github-bot
Copy link
Contributor

Thanks for importing. If you are an FB employee go to https://our.intern.facebook.com/intern/opensource/github/pull_request/899585296789195/int_phab to review.

@vjeux
Copy link
Contributor

vjeux commented Aug 10, 2015

While looking into it, turns out that we don't currently remove if (__DEV__) { } blocks from the minified version. I'm working on fixing it as well.

@gaearon
Copy link
Collaborator

gaearon commented Aug 10, 2015

@dsibiski Thank you!

@vjeux
Copy link
Contributor

vjeux commented Aug 10, 2015

Pull request opened on UglifyJS: mishoo/UglifyJS#767

@amasad
Copy link
Contributor

amasad commented Sep 8, 2015

we also now inline __DEV__ and NODE_ENV checks so that the minifier can safely remove them:

plugins = plugins.concat(['node-env-inline', 'dunderscore-dev-inline']);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants