react-native-expand-dotenv
v0.0.8
Published
Load npm & environment variables from .env
Downloads
16
Maintainers
Readme
react-native-expand-dotenv
Loads npm & environment variables from a .env to react native
Installation
$ npm install --save-dev react-native-expand-dotenv
Usage
package.json / .babelrc
{
"presets": [
"module:metro-react-native-babel-preset",
"module:react-native-expand-dotenv"
]
}
if its monorepo please add ["module:react-native-expand-dotenv", { "dirname": "your_monorepo_package_directory_name"}]
.env
NAME=$npm_package_name
VERSION=$npm_package_version
DOMAIN=https://example.domain
In index.js
import env, { NAME, VERSION, DOMAIN} from 'react-native-expand-dotenv'
process.env = { ...process.env, ...env }
console.log(process.env, { NAME, VERSION, DOMAIN })
Inspiration
react-native-dotenv