Package Exports Support in React Native
Article Summary
React Native just closed a major compatibility gap with the JavaScript ecosystem. Metro now supports Package Exports, unlocking 16,600+ npm packages that were previously broken or inaccessible.
The React Native team shipped beta support for the package.json 'exports' field in Metro bundler with version 0.72. This modern Node.js standard (used by Firebase, Storybook, and thousands of other packages) gives developers better control over package APIs and enables proper React Native for Web support without workarounds.
Key Takeaways
- Package encapsulation now controls which subpaths can be imported from outside
- New 'react-native' condition replaces ambiguous root field for Web targeting
- Metro falls back to legacy resolution with warnings, not errors
- Breaking changes only affect edge cases with sourceExts and platform extensions
- Feature becomes default in React Native 0.73 after beta validation
Critical Insight
React Native apps can now work with significantly more npm packages out of the box while package maintainers gain standardized tools to define public APIs and target multiple platforms.