Conversation
## Summary `unstable_conditionNames` hasn't defaulted to `['require']` since #1447 made Metro assert `import`/`require` per call site, released in Metro 0.82.0. `default` plus one of `import`/`require` is always in the condition set: https://github.com/react/metro/blob/v0.87.0/packages/metro-resolver/src/utils/matchSubpathFromExportsLike.js#L37-L44 and the configured default is empty: https://github.com/react/metro/blob/v0.87.0/packages/metro-config/src/defaults/index.js#L50 `@react-native/metro-config` dropped its static assertion in react/react-native#49780, shipped in React Native 0.79.0, and now sets `['react-native']`: https://github.com/react/react-native/blob/v0.87.1/packages/metro-config/src/index.flow.js#L59 This being wrong might've led people to assume `'import'` should be added alongside, which asserts the ESM branch of every package's `exports` regardless of the call site, and leads to issues such as #1150. Also updates the worked example under `unstable_conditionsByPlatform`, and fixes its anchor link (`#unstable-conditionnames` -> `#unstable_conditionnames-experimental`). Changelog: [Internal] ## Test plan Docs-only. Values checked against source (above).
robhogan
marked this pull request as ready for review
September 1, 2026 06:51
Contributor
|
@vzaidman has imported this pull request. If you are a Meta employee, you can view this in D118261403. |
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
unstable_conditionNamesis currently documented with stale defaults. We haven't included'require'(or'import') since #1447 made Metro assertimport/requiremutually exclusively per call site, released in Metro 0.82.0.defaultplus one ofimport/requireis always in the condition set:https://github.com/react/metro/blob/v0.87.0/packages/metro-resolver/src/utils/matchSubpathFromExportsLike.js#L37-L44
and the configured default is empty:
https://github.com/react/metro/blob/v0.87.0/packages/metro-config/src/defaults/index.js#L50
@react-native/metro-configdropped its static assertion in react/react-native#49780, shipped in RN 0.79.0, and now sets only['react-native']:https://github.com/react/react-native/blob/v0.87.1/packages/metro-config/src/index.flow.js#L59
This being wrong might've led people to assume
'import'should be added alongside, which asserts the ESM branch of every package'sexportsregardless of the call site, and leads to issues such as #1150.Also updates the worked example under
unstable_conditionsByPlatform, and fixes its anchor link (#unstable-conditionnames->#unstable_conditionnames-experimental).Changelog: [Internal]
Test plan
Docs-only. (See static docs preview after import)