Skip to content

Add react-native and browser exports conditions#600

Closed
Comp0te wants to merge 1 commit into
devfrom
fix/package-exports-react-native
Closed

Add react-native and browser exports conditions#600
Comp0te wants to merge 1 commit into
devfrom
fix/package-exports-react-native

Conversation

@Comp0te

@Comp0te Comp0te commented Apr 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Adds react-native and browser conditions to the exports field in package.json, mapped to ./dist/lib.web.js.
  • Fixes resolution under Metro (React Native 0.85+) and web bundlers that honor Package Exports, which previously fell through to the Node build and pulled in Node core modules unavailable in those environments.
  • Conditions are placed above import/require/default so conditional resolution matches them first.

Metro (React Native 0.85+) and web bundlers respect Package Exports
conditions. Without explicit react-native/browser entries, they fall
back to import/require which resolve to the Node build and pull in
Node core modules that don't exist in those environments.

Place react-native and browser above import/require so conditional
resolution picks the web bundle first in those environments.
@Comp0te Comp0te self-assigned this Apr 17, 2026
@Comp0te Comp0te requested a review from alexmyshchyshyn April 17, 2026 13:36
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