Skip to content

fix(modern-js-v3): share JSX runtimes when React is shared - #5307

Open
BleedingDev wants to merge 2 commits into
module-federation:mainfrom
BleedingDev:fix/modernjs-v3-jsx-runtime-sharing
Open

BleedingDev wants to merge 2 commits into
module-federation:mainfrom
BleedingDev:fix/modernjs-v3-jsx-runtime-sharing

Conversation

@BleedingDev

@BleedingDev BleedingDev commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Issue #5154 | Zack Jackson's recommendation

Why the change

A remote can bundle an incompatible JSX runtime even when React is shared, so the Modern.js integration now shares both JSX runtimes with React's policy when React has a local fallback.

Special things to note

  • Only @module-federation/modern-js-v3 changes. Core federation and the standalone Rsbuild integration remain unchanged.
  • Explicit JSX subpath entries and react/ take precedence. Consume-only React with import: false receives no implicit JSX entries. Replacement React imports also need explicit JSX subpath configuration.
  • The full declaration builds stopped on unbuilt workspace dependencies. Full builds and end-to-end checks await CI, which requires maintainer approval.

Change outline

The browser and server configurations use the same defaults:

 patchMFConfig
+  withReactSharedDefaults
+    leave consume-only React and replacement imports unchanged
+    preserve explicit JSX entries and the react/ prefix
+    add each missing JSX runtime with React's sharing policy

The defaults preserve array and object forms without mutating them. They do not reuse React's root import, request, or share key for a JSX runtime. Applying them twice adds nothing further.

All 39 focused tests pass on Node 24. Six consume-only regression cases failed before the review fix. They cover arrays, explicit JSX entries, and both browser and server configurations. Targeted strict TypeScript, package lint, formatting, and commit-message checks pass.

pnpm --filter @module-federation/modern-js-v3 exec rstest run src/cli/reactShared.spec.ts src/cli/configPlugin.spec.ts

Created with GPT-6.1 Sol in Codex.

@changeset-bot

changeset-bot Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 684c1bd

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 48 packages
Name Type
@module-federation/modern-js-v3 Patch
shared-tree-shaking-with-server-host Patch
shared-tree-shaking-with-server-provider Patch
@module-federation/devtools Patch
@module-federation/cli Patch
create-module-federation Patch
@module-federation/dts-plugin Patch
@module-federation/enhanced Patch
@module-federation/error-codes Patch
@module-federation/managers Patch
@module-federation/manifest Patch
@module-federation/metro Patch
@module-federation/metro-plugin-rnc-cli Patch
@module-federation/metro-plugin-rnef Patch
@module-federation/metro-plugin-rock Patch
@module-federation/modern-js Patch
@module-federation/retry-plugin Patch
@module-federation/rsbuild-plugin Patch
@module-federation/rspack Patch
@module-federation/rspress-plugin Patch
@module-federation/rstest Patch
@module-federation/runtime-core Patch
@module-federation/runtime-tools Patch
@module-federation/runtime Patch
@module-federation/sdk Patch
@module-federation/third-party-dts-extractor Patch
@module-federation/treeshake-frontend Patch
@module-federation/treeshake-server Patch
@module-federation/webpack-bundler-runtime Patch
@module-federation/bridge-react-webpack-plugin Patch
@module-federation/bridge-react Patch
@module-federation/bridge-shared Patch
@module-federation/bridge-vue3 Patch
@module-federation/inject-external-runtime-core-plugin Patch
@module-federation/nextjs-mf Patch
@module-federation/node Patch
@module-federation/storybook-addon Patch
shared-tree-shaking-no-server-host Patch
shared-tree-shaking-no-server-provider Patch
website-new Patch
@module-federation/playground Patch
remote5 Patch
remote6 Patch
@module-federation/esbuild Patch
@module-federation/observability-plugin Patch
@module-federation/utilities Patch
node-dynamic-remote-new-version Patch
node-dynamic-remote Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-28T23:16:42.818952Z 1fac39b PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1fac39bb9a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant