zetachang / react-native-dotenv

A Babel preset let you import application configs from .env file (zero runtime dependency)
MIT License
915 stars 68 forks source link

Why depend on babel-plugin-dotenv npm package? #62

Open aakashsigdel opened 5 years ago

aakashsigdel commented 5 years ago

I see that there is a local copy of babel-plugin-dotenv. But we don't depend on this, instead we are depending on the babel-plugin-dotenv npm package if user has this installed on node modules.

What is the reasoning behind this?

aakashsigdel commented 5 years ago

According to dotenv documentation:

What happens to environment variables that were already set? We will never modify any environment variables that have already been set. In particular, if there is a variable in your .env file which collides with one that already exists in your environment, then that variable will be skipped. This behavior allows you to override all .env configurations with a machine-specific environment, although it is not recommended.

Currently this library doesn't do that. I want to submit a PR that will align this repo more with dotenv.

The problem is currently we are depending on babel-plugin-dotenv lib even though we have a copy of that lib in this repo. So I am not sure if I should submit the PR to that repo or here.

Since this is a RN specific repo, it makes sense to submit RN specific changes here instead of babel-plugin-dotenv. But for this we will have to depend on the local copy of babel-plugin-dotenv instead of the original npm package.

PR: https://github.com/zetachang/react-native-dotenv/pull/63