react-native/local-cli/bundle
Valeri Karpov 402e7eaac2 Don't clobber user-defined environment variables
Summary:
Re: javache 's suggestions from https://github.com/facebook/react-native/pull/7878. Didn't want to deal with the merge conflict so I'm opening a separate PR. Here's the original justification:

If I want to set NODE_ENV to "baconator", I should be allowed to. Mutating global state that most devs assume to be immutable is just abysmal dev practice, especially since this mutation only happens when you're building for prod, not running on the simulator.

To test this, run env NODE_ENV=baconator ./gradlew assembleRelease with babel-plugin-transform-inline-environment-variables in your app/.babelrc. You'll see that the final app has NODE_ENV=production.

As a side note, running with babel-plugin-transform-inline-environment-variables in the top-level .babelrc crashes horribly with a compiler error.

For anybody who runs into this bug and doesn't feel like waiting for this to get merged, I wrote a quick babel plugin to remove assignments to process.env, which is sufficient to fix this issue.
Closes https://github.com/facebook/react-native/pull/8057

Differential Revision: D3419950

Pulled By: javache

fbshipit-source-id: dc541cad0a99906433e5c14bbc93ce66b4ed325e
2016-06-10 15:28:29 -07:00
..
__mocks__ Move `private-cli` commands to `local-cli` 2015-10-26 15:36:04 -07:00
__tests__ Load assets from same folder as JSbundle (Android) 2016-01-06 08:46:35 -08:00
output Fix comment typos 2016-06-03 02:43:57 -07:00
assetPathUtils.js Load assets from same folder as JSbundle (Android) 2016-01-06 08:46:35 -08:00
buildBundle.js Don't clobber user-defined environment variables 2016-06-10 15:28:29 -07:00
bundle.js Add packager worker for Buck 2016-03-18 12:45:29 -07:00
bundleCommandLineArgs.js Packager: accept relative --transformer paths everywhere. 2016-06-06 17:58:25 -07:00
getAssetDestPathAndroid.js Load assets from same folder as JSbundle (Android) 2016-01-06 08:46:35 -08:00
getAssetDestPathIOS.js Move `private-cli` commands to `local-cli` 2015-10-26 15:36:04 -07:00
saveAssets.js bugfix #3997: react-native bundle not working on windows 10 2015-11-27 08:22:29 -08:00
sign.js Move `private-cli` commands to `local-cli` 2015-10-26 15:36:04 -07:00
signedsource.js Move `private-cli` commands to `local-cli` 2015-10-26 15:36:04 -07:00
unbundle.js Add packager worker for Buck 2016-03-18 12:45:29 -07:00