-
Notifications
You must be signed in to change notification settings - Fork 160
[eas-build] warn when creating a production build from Expo Go #3073
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[eas-build] warn when creating a production build from Expo Go #3073
Conversation
|
Size Change: +2.22 kB (0%) Total Size: 53.5 MB
|
|
Subscribed to pull request
Generated by CodeMention |
c801227 to
1419630
Compare
Codecov ReportAttention: Patch coverage is
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. 🚀 New features to boost your workflow:
|
6bc2131 to
f303ad9
Compare
| import type { ProfileData } from '../utils/profiles'; | ||
| import type { Client } from '../vcs/vcs'; | ||
|
|
||
| const envVarName = 'EAS_BUILD_NO_EXPO_GO_WARNING'; |
There was a problem hiding this comment.
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
f303ad9 to
9107eb9
Compare
sjchmiela
left a comment
There was a problem hiding this 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 = ( |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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?
eas-cli/packages/eas-cli/src/build/utils/devClient.ts
Lines 106 to 114 in ab8115b
| 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) { |
There was a problem hiding this comment.
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.
0bd94bb to
8c58773
Compare
8c58773 to
6b3940a
Compare
|
✅ Thank you for adding the changelog entry! |
| 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, | ||
| }) | ||
| ); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
brentvatne
left a comment
There was a problem hiding this 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
| 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, | ||
| }) | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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); |
There was a problem hiding this comment.
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

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-clientis 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