Skip to content

[build-tools] Use production mode for app config and Expo commands - #4180

Open
ramonclaudio wants to merge 13 commits into
mainfrom
@ramonclaudio/dvt-119-eas-config-mode-handoff
Open

[build-tools] Use production mode for app config and Expo commands#4180
ramonclaudio wants to merge 13 commits into
mainfrom
@ramonclaudio/dvt-119-eas-config-mode-handoff

Conversation

@ramonclaudio

@ramonclaudio ramonclaudio commented Aug 12, 2026

Copy link
Copy Markdown
Member

Why

EAS Build can use an existing NODE_ENV when it loads app config or runs Expo commands, which can make it load different env files for the same build.

How

I updated EAS Build to use production mode for app config, prebuild, Expo Doctor, and runtime version resolution, and kept the original build env for dep installs.

Test Plan

Tests and CI checks pass.

@linear-code

linear-code Bot commented Aug 12, 2026

Copy link
Copy Markdown

DVT-119

@codecov

codecov Bot commented Aug 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.86%. Comparing base (3f8ffac) to head (df98b5f).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4180      +/-   ##
==========================================
+ Coverage   63.74%   63.86%   +0.12%     
==========================================
  Files        1030     1032       +2     
  Lines       47477    47511      +34     
  Branches     9990     9993       +3     
==========================================
+ Hits        30260    30338      +78     
+ Misses      17116    17072      -44     
  Partials      101      101              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ramonclaudio
ramonclaudio force-pushed the @ramonclaudio/dvt-119-eas-config-mode-handoff branch from 0822cb4 to bdc5d2b Compare August 13, 2026 13:48
@ramonclaudio ramonclaudio changed the title [build-tools] Use production mode for Expo commands during EAS Build [build-tools] Use production mode for app config, prebuild, and Expo Doctor Aug 13, 2026
@ramonclaudio ramonclaudio changed the title [build-tools] Use production mode for app config, prebuild, and Expo Doctor [build-tools][eas-cli] Use production mode for Expo commands Aug 16, 2026
@ramonclaudio ramonclaudio changed the title [build-tools][eas-cli] Use production mode for Expo commands [build-tools] Use production mode for app config, prebuild, and Expo Doctor Aug 16, 2026
@ramonclaudio
ramonclaudio force-pushed the @ramonclaudio/dvt-119-eas-config-mode-handoff branch from ad8a21c to 0822cb4 Compare August 16, 2026 14:13
ramonclaudio added a commit to expo/expo that referenced this pull request Aug 17, 2026
# Why

The EAS changes in [#4180](expo/eas-cli#4180)
tell Expo to use development or production mode when loading app config,
so we needed a temporary internal environment variable that Expo reads
and removes before app config loads.

# How

I added `__EXPO_CONFIG_MODE` as an internal handoff that `@expo/env`
reads and removes before Expo loads the dotenv files and app config. I
blocked `.env` files from setting the handoff and updated
`getOriginalEnv()` and `getOriginalEnvValue()` to exclude dotenv values
inherited from a parent process. We still use `EAS_BUILD` as the
production fallback for older EAS versions.

# Test Plan

Tests and package checks pass.

# Checklist

- [x] I added a `changelog.md` entry and rebuilt the package sources
according to [this short
guide](https://github.com/expo/expo/blob/main/CONTRIBUTING.md#-before-submitting)
- [ ] This diff will work correctly for `npx expo prebuild` & EAS Build
(eg: updated a module plugin).
- [ ] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
@ramonclaudio
ramonclaudio force-pushed the @ramonclaudio/dvt-119-eas-config-mode-handoff branch from 0822cb4 to e3e4ea2 Compare August 18, 2026 22:23
@ramonclaudio
ramonclaudio deleted the @ramonclaudio/dvt-119-eas-config-mode-handoff branch August 18, 2026 22:51
@ramonclaudio
ramonclaudio restored the @ramonclaudio/dvt-119-eas-config-mode-handoff branch August 18, 2026 22:54
@ramonclaudio ramonclaudio reopened this Aug 18, 2026
@ramonclaudio
ramonclaudio force-pushed the @ramonclaudio/dvt-119-eas-config-mode-handoff branch from a028130 to f045885 Compare August 19, 2026 14:30
@ramonclaudio
ramonclaudio force-pushed the @ramonclaudio/dvt-119-eas-config-mode-handoff branch from f045885 to 2ce2235 Compare August 19, 2026 18:51
@ramonclaudio ramonclaudio changed the title [build-tools] Use production mode for app config, prebuild, and Expo Doctor [build-tools] Use production mode for app config and Expo commands Aug 19, 2026
@ramonclaudio
ramonclaudio marked this pull request as ready for review August 19, 2026 19:23
@ramonclaudio
ramonclaudio marked this pull request as draft August 19, 2026 21:34
@ramonclaudio
ramonclaudio force-pushed the @ramonclaudio/dvt-119-eas-config-mode-handoff branch from 2ce2235 to df98b5f Compare August 21, 2026 14:08
@github-actions

Copy link
Copy Markdown

✅ Thank you for adding the changelog entry!

@ramonclaudio

Copy link
Copy Markdown
Member Author

/review

@github-actions

Copy link
Copy Markdown

🤖 AI code review

Decision: Ready for human review

Overall PR risk: High. The change modifies existing behavior. It forces NODE_ENV=production and __EXPO_CONFIG_MODE=production for expo config, expo prebuild, expo-doctor, and runtime version resolution inside EAS Build, and it changes how .env files merge with the build environment. No reviewer found a concrete correctness or security defect, so no findings are reported. The main risk is that the CLI-side runtime version resolution was not updated to match, so a build could compute a different runtime version than eas update, which could stop updates from reaching that build; a project that relies on NODE_ENV to pick its app config or .env file could also resolve a different config now. This is a broad, unflagged change across every EAS build that reads app config, prebuilds, or resolves a runtime version, so rollback means reverting the whole PR.

No findings.


This review is advisory — it never blocks a merge and never auto-approves.

@ramonclaudio

Copy link
Copy Markdown
Member Author

/verify

@ramonclaudio
ramonclaudio marked this pull request as ready for review August 21, 2026 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant