With the release of React Native 0.72, Metro — our JavaScript build tool — now includes beta support for the package.json
"exports"
field. When enabled, it adds the following functionality:
- React Native projects will work with more npm packages out-of-the-box
- New capabilities for packages to define their API and target React Native
- Some breaking changes to package resolution (in edge cases)
In this post we'll cover how Package Exports works, and what these changes mean for you as a React Native app developer or package maintainer.