react-native-dotenv
Advanced tools
Comparing version 3.4.4 to 3.4.6
{ | ||
"name": "react-native-dotenv", | ||
"version": "3.4.4", | ||
"version": "3.4.6", | ||
"description": "Load environment variables using import statements.", | ||
@@ -26,4 +26,3 @@ "repository": "github:goatandsheep/react-native-dotenv", | ||
"dependencies": { | ||
"dotenv": "^16.0.3", | ||
"@babel/core": "^7.20.5" | ||
"dotenv": "^16.0.3" | ||
}, | ||
@@ -63,2 +62,3 @@ "devDependencies": { | ||
"peerDependencies": { | ||
"@babel/core": "^7.20.5", | ||
"@babel/runtime": "^7.20.6" | ||
@@ -65,0 +65,0 @@ }, |
@@ -82,3 +82,3 @@ # react-native-dotenv [![CircleCI](https://circleci.com/gh/goatandsheep/react-native-dotenv.svg?style=svg)](https://circleci.com/gh/goatandsheep/react-native-dotenv) | ||
Also preview [the upcoming test app](https://github.com/goatandsheep/chatkitty-example-react-native/). | ||
Also preview [the expo test app](https://github.com/goatandsheep/react-native-dotenv-expo-test). | ||
@@ -248,2 +248,4 @@ ## [DEPRECATED] White and black lists | ||
If you are not familiar with how dotenv or Babel work, make sure to read the following reference materials: | ||
* [babel environments](https://babeljs.io/docs/en/6.26.3/babelrc#env-option) | ||
@@ -253,7 +255,22 @@ * [dotenv documentation](https://www.npmjs.com/package/dotenv) | ||
## Caveats | ||
### How this works | ||
This Babel plugin processes your `.env` files and your environment variables and replaces the references to the environment variables in your code before it runs. This is because the environment variables will no longer be accessible once the React Native engine generates the app outputs. | ||
## Cacheing | ||
When using with [`babel-loader`](https://github.com/babel/babel-loader) with caching enabled you will run into issues where environment changes won’t be picked up. | ||
This is due to the fact that `babel-loader` computes a `cacheIdentifier` that does not take your environment into account. | ||
This is due to the fact that `babel-loader` computes a `cacheIdentifier` that does not take your `.env` file(s) into account. The good news is that a recent update has fixed this problem as long as you're using a new version of Babel. Many react native libraries have not updated their Babel version yet so to force the version, add in your `package.json`: | ||
```json | ||
"resolutions": { | ||
"@babel/core": "^7.20.2", | ||
"babel-loader": "^8.3.0" | ||
} | ||
``` | ||
If this does not work, you should set `api.cache(false)` in your babel config | ||
metro.config.js`resetCache: true` | ||
You can easily clear the cache: | ||
@@ -289,6 +306,2 @@ | ||
You can also set `api.cache(false)` in your babel config | ||
metro.config.js`resetCache: true` | ||
Maybe a solution for updating package.json scripts: | ||
@@ -295,0 +308,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
50434
103
333
- Removed@babel/core@^7.20.5