Skip to content

Conversation

@marco-saia-datadog
Copy link
Member

@marco-saia-datadog marco-saia-datadog commented Sep 16, 2025

What does this PR do?

Adds support for Metro 0.83+ imports.

Motivation

Internal Metro imports have changed in metro@0.83. Importing internals from metro/src/.. is no longer supported. Internals are now only accessible via metro/private/....

We rely on these imports for our custom Metro/Expo Configuration, and we have to address these breaking changes to support Expo SDK 54.

Additional Notes

The changes are retro-compatible

If an import from metro/private/... fails, it will gracefully fallback to importing from metro/src/..., to grant compatibility with Metro < 0.83

Retrieving the default exports

I have wrapped require statements with a new utility function getDefaultExport, which returns importedModule.default if default exists, otherwise it returns importedModule directly, to support both CommonJS and ESM syntax exports.

From the next Metro patch version 0.83.2 this will be required to ensure retro-compatibility, as the project is moving towards ESM syntax:

- module.exports = Foo;
+ export default Foo;

Merge Readiness

  • Waiting for successful internal testing

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)
  • If this PR is auto-generated, please make sure also to manually update the code related to the change

@marco-saia-datadog marco-saia-datadog requested a review from a team as a code owner September 16, 2025 10:23
Copy link
Contributor

@cdn34dd cdn34dd left a comment

Choose a reason for hiding this comment

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

Overall it looks good, well done, just some small improvements to avoid repetition.

sbarrio
sbarrio previously approved these changes Sep 17, 2025
@marco-saia-datadog marco-saia-datadog force-pushed the marcosaia/RUM-11727/support-metro-83 branch from e2327a5 to 99a91f2 Compare September 18, 2025 10:09
@marco-saia-datadog marco-saia-datadog merged commit 8c8dbaa into develop Sep 18, 2025
11 checks passed
@marco-saia-datadog marco-saia-datadog deleted the marcosaia/RUM-11727/support-metro-83 branch September 18, 2025 12:00
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