-
-
Notifications
You must be signed in to change notification settings - Fork 48
Home
Kemal Ahmed edited this page Feb 14, 2024
·
55 revisions
Welcome to the react-native-dotenv wiki!
- make sure to add metro (I dont remember why)
module.exports = {
"presets": ["module:metro-react-native-babel-preset"],
"plugins": [
["module:react-native-dotenv"]
]
}
- for typescript, set moduleName to
react-native-dotenv
, clear cache jest --no-cache
- add windows instructions for
APP_ENV=
- is there a way to automatically install as babel plugin not preset?
- is there a way to automatically install as devDependency not regular dependency?
--env-file=.env
react-native clean
- only use APP_ENV, but don't use APP_ENV for production nor development in the run-platform commands. just use debug/release in run-platform.
- this won't work when you do
react-native run-android
orreact-native run-ios
, but it's okay because you just need to run the command once to do the initial build. After that point, you should be able to build changes usingreact-native start
where this will work - api.cache(false) resets babel cache and --reset-cache resets all caches. the latter is slower, but doesn't fully clear the caches so reset-cache is needed
- APP_ENV=custom works for run-android, you must run npm start between each time you run npm run-android
- for npm run android, you need to do --tasks clean,installRelease
- APP_ENV=production works in start command
module.exports = function(api) {
api.cache(false)
}