Skip to content

Conversation

@vonovak
Copy link
Contributor

@vonovak vonovak commented Jun 25, 2025

Why

https://linear.app/expo/issue/ENG-14242

How

Added a function that detects Expo Go project through existing functionality and through looking for if expo-dev-client is installed.

If the project is Expo-Go based, and user attempts to create a production build, a warning is printed. The warning can be silenced via an env variable.

Test Plan

  • Tested locally in an Expo Go project, this is the result:

Screenshot 2025-06-25 at 09.21.59.png

  • added a few automated tests

Copy link
Contributor Author

vonovak commented Jun 25, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions
Copy link

github-actions bot commented Jun 25, 2025

Size Change: +2.22 kB (0%)

Total Size: 53.5 MB

Filename Size Change
./packages/eas-cli/dist/eas-linux-x64.tar.gz 53.5 MB +2.22 kB (0%)

compressed-size-action

@vonovak vonovak marked this pull request as ready for review June 25, 2025 08:29
@github-actions
Copy link

Subscribed to pull request

File Patterns Mentions
**/* @sjchmiela

Generated by CodeMention

@vonovak vonovak changed the title [eas-build] discourage Expo Go for production [eas-build] warn when creating a prod build from an Expo Go app Jun 25, 2025
@vonovak vonovak changed the title [eas-build] warn when creating a prod build from an Expo Go app [eas-build] warn when creating a production build from Expo Go Jun 25, 2025
@vonovak vonovak force-pushed the vonovak/_eas-build_discourage_expo_go_for_production branch from c801227 to 1419630 Compare June 25, 2025 08:33
@codecov
Copy link

codecov bot commented Jun 25, 2025

Codecov Report

Attention: Patch coverage is 65.00000% with 14 lines in your changes missing coverage. Please review.

Project coverage is 52.37%. Comparing base (ce8e098) to head (9107eb9).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...ges/eas-cli/src/project/discourageExpoGoForProd.ts 67.65% 11 Missing ⚠️
packages/eas-cli/src/build/createContext.ts 33.34% 2 Missing ⚠️
packages/eas-cli/src/build/runBuildAndSubmit.ts 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3073      +/-   ##
==========================================
+ Coverage   52.33%   52.37%   +0.05%     
==========================================
  Files         604      605       +1     
  Lines       24120    24155      +35     
  Branches     4816     4820       +4     
==========================================
+ Hits        12620    12648      +28     
- Misses      11461    11468       +7     
  Partials       39       39              

☔ View full report in Codecov by Sentry.
📢 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.

@vonovak vonovak force-pushed the vonovak/_eas-build_discourage_expo_go_for_production branch 4 times, most recently from 6bc2131 to f303ad9 Compare June 25, 2025 08:44
import type { ProfileData } from '../utils/profiles';
import type { Client } from '../vcs/vcs';

const envVarName = 'EAS_BUILD_NO_EXPO_GO_WARNING';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking for opinion on whether this is a good name

@vonovak vonovak force-pushed the vonovak/_eas-build_discourage_expo_go_for_production branch from f303ad9 to 9107eb9 Compare June 25, 2025 08:46
@vonovak vonovak requested a review from sjchmiela June 25, 2025 08:47
Copy link
Contributor

@sjchmiela sjchmiela left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll reassign this to Brent. Left some code suggestions.


const suppressionEnvVarName = 'EAS_BUILD_NO_EXPO_GO_WARNING';

export const discourageExpoGoForProd = (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would not try to do anything smart here with the non-awaited Promise. Can we just await this? Does this add significant time to the build process?

If we do this asynchronously it might happen that a chain of thought log may be broken by this warning.

return workflows.android === Workflow.MANAGED && workflows.ios === Workflow.MANAGED;
}

function checkIfExpoDevClientInstalled(projectDir: string): boolean {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use isExpoDevClientInstalledAsync instead?

async function isExpoDevClientInstalledAsync(projectDir: string): Promise<boolean> {
try {
resolveFrom(projectDir, 'expo-dev-client/package.json');
return true;
} catch (err: any) {
Log.debug(err);
return false;
}
}

): void => {
detectExpoGoProdBuildAsync(buildProfiles, projectDir, vcsClient)
.then(usesExpoGo => {
if (usesExpoGo) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you do if (!usesExpoGo) code will be indented a bit less and, in my opinion, more readable.

@sjchmiela sjchmiela requested a review from brentvatne June 25, 2025 20:36
@vonovak vonovak force-pushed the vonovak/_eas-build_discourage_expo_go_for_production branch 2 times, most recently from 0bd94bb to 8c58773 Compare June 26, 2025 10:59
@vonovak vonovak force-pushed the vonovak/_eas-build_discourage_expo_go_for_production branch from 8c58773 to 6b3940a Compare June 26, 2025 11:01
@github-actions
Copy link

✅ Thank you for adding the changelog entry!

Comment on lines +28 to +36
Log.warn(
`⚠️ It appears you're trying to build an app based on Expo Go for production. Expo Go is not a suitable environment for production apps.`
);
Log.warn(
learnMore('https://docs.expo.dev/develop/development-builds/expo-go-to-dev-build/', {
learnMoreMessage: 'Learn more about converting from Expo Go to a development build',
dim: false,
})
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'll think about how to improve the wording on this and get back to you, let's hold off on merging for now

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Detected that your app uses Expo Go for development, this is not recommended when building production apps. (fyi link here)


fyi page:

Expo Go is meant for learning and prototyping. Learn more.

Behavior of production builds may differ significantly from the Expo Go app, because it is a precompiled sandbox app and your customizations that will apply to production apps and development will likely not be testable in Expo Go.

For example, if you add a library with native code that is not in the Expo SDK, that will not be available in Expo Go. If that library does not actually compile due to an error or incompatibility, you will only discover this when you run a production build. Additionally, most fields in your app.json do not have any impact on your app when it runs in Expo Go, but they will apply when you run a production or development build. Examples of such properties are: scheme, splash (only the app icon is used in Expo Go), any plugins, edgeToEdgeEnabled, predictiveBackGestureEnabled, and so on.

Development builds provide a reliable and flexible development environment, and behave more predictably and similar to production builds. This makes it easier to catch potential issues during development.

Learn more about converting from Expo Go to a development build.

Copy link
Member

@brentvatne brentvatne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good w/ changes we discussed on call and added in comments

Comment on lines +28 to +36
Log.warn(
`⚠️ It appears you're trying to build an app based on Expo Go for production. Expo Go is not a suitable environment for production apps.`
);
Log.warn(
learnMore('https://docs.expo.dev/develop/development-builds/expo-go-to-dev-build/', {
learnMoreMessage: 'Learn more about converting from Expo Go to a development build',
dim: false,
})
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Detected that your app uses Expo Go for development, this is not recommended when building production apps. (fyi link here)


fyi page:

Expo Go is meant for learning and prototyping. Learn more.

Behavior of production builds may differ significantly from the Expo Go app, because it is a precompiled sandbox app and your customizations that will apply to production apps and development will likely not be testable in Expo Go.

For example, if you add a library with native code that is not in the Expo SDK, that will not be available in Expo Go. If that library does not actually compile due to an error or incompatibility, you will only discover this when you run a production build. Additionally, most fields in your app.json do not have any impact on your app when it runs in Expo Go, but they will apply when you run a production or development build. Examples of such properties are: scheme, splash (only the app icon is used in Expo Go), any plugins, edgeToEdgeEnabled, predictiveBackGestureEnabled, and so on.

Development builds provide a reliable and flexible development environment, and behave more predictably and similar to production builds. This makes it easier to catch potential issues during development.

Learn more about converting from Expo Go to a development build.

);
Log.newLine();
} catch (err) {
Log.warn('Error detecting whether Expo Go is used:', err);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only show this is debug, ideally log this to sentry also so we can get some info on when/how this happens

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.

4 participants