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 React Native subpath imports #2133

Merged
merged 7 commits into from
Nov 5, 2024
Merged

Conversation

smaye81
Copy link
Member

@smaye81 smaye81 commented Nov 5, 2024

Using the Metro bundler with React Native requires enabling package exports (docs) via a Metro config file. This adds said file and some necessary dependencies.

Note that we also spell this out in our Protobuf-ES docs.

It seems odd to have to use the react-native-svg-transformer here. But without it, we get asset errors. This combination here appears to be the right incantation to get things to work. Taken from this issue.

@smaye81 smaye81 requested a review from timostamm November 5, 2024 16:54
unstable_allowRequireContext: true,
},
resolver: {
unstable_enablePackageExports: true,
Copy link
Member

Choose a reason for hiding this comment

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

It's added to the FAQ here: connectrpc/connectrpc.com#218

If that's too difficult to link to, can we add a comment that replicates the gist of it? E.g.

Connect-ES and Protobuf-ES use package exports. We need to enable support for them in Metro. See https://metrobundler.dev/docs/package-exports/

Copy link
Member Author

Choose a reason for hiding this comment

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

Lmk if this is what you had in mind.

Signed-off-by: Steve Ayers <[email protected]>
Signed-off-by: Steve Ayers <[email protected]>
Signed-off-by: Steve Ayers <[email protected]>
Signed-off-by: Steve Ayers <[email protected]>
Signed-off-by: Steve Ayers <[email protected]>
Signed-off-by: Steve Ayers <[email protected]>
Signed-off-by: Steve Ayers <[email protected]>
@smaye81 smaye81 force-pushed the sayers/fix_rn_subpath_imports branch from 81934b0 to 0f1dd47 Compare November 5, 2024 17:38
@smaye81 smaye81 merged commit 938b4cb into main Nov 5, 2024
6 checks passed
@smaye81 smaye81 deleted the sayers/fix_rn_subpath_imports branch November 5, 2024 18:49
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