fix: align react peerDependencies across react-components packages - #36551
Open
Martin Hochel (Hotell) wants to merge 2 commits into
Open
fix: align react peerDependencies across react-components packages#36551Martin Hochel (Hotell) wants to merge 2 commits into
Martin Hochel (Hotell) wants to merge 2 commits into
Conversation
All v9 packages depend on `@fluentui/react-jsx-runtime`, which imports `react/jsx-runtime` directly. That entry point was only backported to the 16.x line in react@16.14.0 (react@16.13.1 ships no jsx-runtime files), so `react >=16.14.0` is a hard floor. 12 packages advertised a `>=16.8.0` lower bound on some subset of react/react-dom/@types/react/@types/react-dom, which is unsatisfiable in practice. The skew originated in microsoft#31937, which reverted a bad release that wrote `"react": "^8.119.0"` into peerDependencies but only restored the `react` key, leaving the other three behind. microsoft#35145 then swept `<19.0.0` -> `<20.0.0` while preserving the existing lower bounds, freezing the skew in place. All publishable `packages/react-components/**` packages now use: "@types/react": ">=16.14.0 <20.0.0" "@types/react-dom": ">=16.9.0 <20.0.0" "react": ">=16.14.0 <20.0.0" "react-dom": ">=16.14.0 <20.0.0" `@types/react-dom` stays at `>=16.9.0` because no 16.14.x was ever published for it (16.x ends at 16.9.25) - see microsoft#30259. Also updates the `react-library` generator template, which still emitted `<19.0.0` because microsoft#35145 did not touch `tools/`, so every newly scaffolded package started life with a stale upper bound. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Yarn records workspace peerDependencies in the lockfile, so changing them in package.json makes yarn.lock stale and `yarn install --immutable` fails with YN0028 in CI. Regenerated via `yarn install --mode=update-lockfile`. The diff is 35 lines, all of them react/react-dom/@types peer ranges on the 12 realigned workspace entries - no resolution, version or checksum changes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
📊 Bundle size report✅ No changes found |
|
Pull request demo site: URL |
Martin Hochel (Hotell)
marked this pull request as ready for review
August 11, 2026 22:20
Martin Hochel (Hotell)
requested review from
a team,
Mitch-At-Work,
Valentyna (ValentinaKozlova),
Dmytro Kirpa (dmytrokirpa) and
Victor Genaev (mainframev)
as code owners
August 11, 2026 22:20
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.
Previous Behavior
Peer dependency ranges for
react,react-dom,@types/reactand@types/react-domhad drifted into 5 different signatures across publishablepackages/react-components/**packages, 12 of which were internally incoherent:reactreact-dom@types/react@types/react-dom>=16.14.0>=16.14.0>=16.14.0>=16.9.0>=16.14.0>=16.14.0>=16.14.0>=16.8.0>=16.8.0>=16.8.0>=16.8.0>=16.14.0>=16.14.0>=16.9.0>=16.8.0>=16.8.0>=16.8.0>=16.8.0Every v9 package depends on
@fluentui/react-jsx-runtime, which does a hard module import ofreact/jsx-runtime:That entry point was only backported to the 16.x line in react@16.14.0 — verified by unpacking both tarballs:
So
react >=16.14.0is a hard floor. Any package advertising>=16.8.0lets a consumer on React 16.8–16.13 install cleanly and then fail to resolvereact/jsx-runtimeat build/runtime.How the skew happened
400cd5a243— a bad release run wrote the package's own version into peers:"react": "^8.119.0", across ~97package.jsonfiles.4edb54ea6e) reverted it — but restored only thereactkey, hand-assigning>=16.14.0to 63 entries and>=16.8.0to the rest.react-dom,@types/reactand@types/react-domwere left untouched at whatever they had. This is the origin of the mismatch.eb7f6d51c2) added React 19 support via a mechanical<19.0.0→<20.0.0sweep. It preserved lower bounds verbatim, freezing the skew in place — and it never touchedtools/, leaving the generator template stale.New Behavior
All publishable
packages/react-components/**packages collapse to one signature:@types/react-domintentionally stays at>=16.9.0: no16.14.xwas ever published for it (16.x ends at16.9.25), which is exactly what #30259 fixed. Every other package keeps>=16.14.0.12 packages normalized:
react-infolabel,react-list,react-message-bar,react-motion,react-rating,react-swatch-picker,react-teaching-popover,react-datepicker-compat,react-migration-v8-v9,react-calendar-compat,react-icons-compat,react-timepicker-compatThe 5 non-DOM packages (
react-utilities,react-jsx-runtime,react-shared-contexts,react-portal-compat,react-portal-compat-context) correctly declare noreact-dompeer and were already canonical — untouched.Generator template fixed:
tools/workspace-plugin/src/generators/react-library/files/package.json__tmpl__still emitted<19.0.0, so every package scaffolded since #35145 started life with a stale upper bound.This is metadata-only — no source, build output or runtime behavior changes. It narrows an advertised range that was never actually supported, so no consumer on a working configuration is affected.
Validation
beachball check→ clean (12patchchange files, one per changed package)nx run workspace-plugin:test --testPathPatterns=react-library→ 3 tests, 10 snapshots passedprettier --check→ cleanFollow-up (not in this PR)
Nothing prevents this from drifting again —
normalize-package-dependenciesonly validates internal workspace deps and deliberately skips external peers. A coherence check for the four react peers would make this regression-proof. Happy to add it here or in a separate PR.Related Issue(s)