1 min read
Expo Env Load Behavior
mobilereact-nativeexpo
behavior on how Expo load env on dev server, EAS Build, and EAS Updates
Expo has different behavior on how it loads env variables on dev server, EAS Build, and EAS Updates
-
On dev server and EAS Updates, by default it will load
.env -
On EAS Build (unless we upload
.envto EAS Build or exclude .env* from .gitignore), it’s recommended to define it ineas.json. EAS build only has access to files being not ignored through gitignore and EAS secrets. -
To make sure EAS Updates load the desired env:
- Define
NODE_ENVand.env.${ENVIRONMENT_NAME}. For example we want to use.env.production: - Add
--clear-cacheto make sure it load the most fresh value
Terminalnpx cross-env NODE_ENV=production eas update --channel production --message "fix issues" - Define
References: