Expo Env Load Behavior
behavior on how Expo load env on dev server, EAS Build, and EAS Updates
85 views
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
.env
to 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_ENV
and.env.${ENVIRONMENT_NAME}
. For example we want to use.env.production
: - Add
--clear-cache
to make sure it load the most fresh value
bash
npx cross-env NODE_ENV=production eas update --channel production --message "fix issues"
- Define
References: