You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[skip ci] Define "exports" field on main package (facebook#50872)
Summary:
NOTE: Resubmission of D71968187.
Define `"exports"` field on the main `react-native` package.
**Notes**
Module resolution should be equivalent to the previous implicit `"main"` field (backwards compatible).
- Exports all module subpaths to JavaScript (Flow) source files, with and without `.js` suffix (unchanged ✅)
- These are restricted to the `flow/` and `Libraries/` subdirectories (ℹ️ this should be unchanged, matching any JS imports apps may have today)
- Still includes 3P integration scripts such as `./jest-preset.js` and `./rn-get-polyfills.js` (unchanged ✅)
- Exports `./package.json` (unchanged ✅)
- TypeScript should:
- fall back to the `"types"` field (unchanged ✅)
- OR to `"."`,`"./*"` when Package Exports support is enabled via `compilerOptions`, and use the *adjacent `.d.ts` file* (unchanged ✅)
Changelog:
[General][Breaking] - The `react-native` package now defines package.json `"exports"`.
- While these expose existing JavaScript and TypeScript modules, this change may affect deep imports of non-JS files via Node in third party tools.
- Jest mocks to a `react-native` subpath will need to be updated to match the import path used in your code.
- Imports from `src/` and `src/private/` directories are disallowed.
Reviewed By: robhogan
Differential Revision: D72228547
0 commit comments