agustinusnathaniel.com

Expo Env Load Behavior

behavior on how Expo load env on dev server, EAS Build, and EAS Updates

101 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 in eas.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:
    1. Define NODE_ENV and .env.${ENVIRONMENT_NAME}. For example we want to use .env.production:
    2. 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"
    • references: https://github.com/expo/eas-cli/issues/2174#issuecomment-2053109651

References:


BaseBookmarksT.I.L.TemplatesTimelineAnalytics

© 2024 Agustinus Nathaniel