Skip to content
This repository has been archived by the owner on Jul 8, 2020. It is now read-only.

Support for multiple environments #28

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

uLan08
Copy link

@uLan08 uLan08 commented Oct 10, 2017

Closes #19
Reviews and criticisms are gladly welcome. Hope you have the time to check.

@zetachang
Copy link
Owner

Hi, thanks for working on this.

The bad news is that RN packager will try to overwrite process.env.BABEL_ENV. (see https://github.com/facebook/metro-bundler/blob/d1d59d81e5926acdc745dac40ba9423f87f1f789/packages/metro-bundler/src/transformer.js#L133)

I've always want to file a ticket for RN to claim the need that the packager should allow variant of default dev & product env. (In most use case, staging might be a variant of production env)

@uLan08
Copy link
Author

uLan08 commented Oct 11, 2017

Ah darn. Let's file a ticket then, so that we could see what they think about it.

@antonsivogrivov
Copy link

Any news?

var platformPath = (process.env.BABEL_ENV === 'development' || process.env.BABEL_ENV === undefined)
? configFile + '.development'
: configFile + '.production';
var platformPath = configFile + (environments[process.env.BABEL_ENV] || environments['development']);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cant we use a different ´env´ then BABEL_ENV to solve the issue with react-native overridin it?

var platformPath = configFile + (environments[process.env.ENV_FILE] ||

then you can run or build you app with $ ENV_FILE =.env.staging npm run ios

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad didn't see that it was in the babel plugin. So not possible I guess

@brandonxiang
Copy link

any news

@goatandsheep
Copy link

goatandsheep commented May 21, 2020

There's a new repo and package babel-plugin-dotenv-import. Please reopen in the new repo

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

Successfully merging this pull request may close these issues.

Adding more environments ?
6 participants