Skip to content
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

Fix JSON reporter for Expo #399

Merged
merged 4 commits into from
Jul 11, 2024
Merged

Conversation

jakub-gonet
Copy link
Member

@jakub-gonet jakub-gonet commented Jun 21, 2024

Previously, we overrode metro-config to inject our config in Expo apps because Expo doesn't allow for customizing metro config directly.

Expo generates config based on metro-config but then customizes it by overriding reporter setting (see here

To work around that, we replace the base class for TerminalReporter that expo CLI uses with out metro_reporter that we want to set as the reporter in configuration.

Test plan:

  1. Run expo devclient project
  2. Get loading percentage on "waiting app to load" step (which is the percentage from metro that is read using json reporter)

Previously, we overrode metro-config to inject our config in Expo apps
because Expo doesn't allow for customizing metro config directly.

Expo generates config based on metro-config but then customizes it. [1]
To work around that, we plug our config later in a flow, directly before
Metro is started.

[1]: https://github.com/expo/expo/blob/a208802b51c73a2799048d30f1d4b9240bffc6c0/packages/%40expo/cli/src/start/server/metro/instantiateMetro.ts#L94-L108
Copy link

vercel bot commented Jun 21, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-native-ide ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 11, 2024 8:03am

Copy link
Member

@kmagiera kmagiera left a comment

Choose a reason for hiding this comment

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

As discussed offline. Would be good to avoid importing internals from expo cli especially that we already had issues with some changes related to bundling in the past. There is setEventReporter method that's exposed from the config loader in cli codebase. Perhaps we could use that one?

@kmagiera kmagiera merged commit 90da007 into main Jul 11, 2024
2 checks passed
@kmagiera kmagiera deleted the jgonet/fix-metro-reporter-for-expo branch July 11, 2024 08:07
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.

2 participants