Skip to content

fix: share react-dom/client as its own MF module - #83

Merged
kevwilliams merged 1 commit into
mainfrom
fix/share-react-dom-client
Sep 11, 2026
Merged

kevwilliams merged 1 commit into
mainfrom
fix/share-react-dom-client

Conversation

@kevwilliams

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #82. That fix resolved the react-router version-mismatch crash; this fixes the next one that surfaced right after:

```
[Module Federation] Failed to bridge external shared module "react-dom/client"
Error: Minified React error #527
```

React 19's createRoot/hydrateRoot live in react-dom/client, which MF treats as its own distinct shared module from react-dom rather than folding it in automatically. One of this plugin's dependencies imports it (confirmed present in the built remoteEntry.js as its own shared chunk), but it was never declared in shared, so MF tried to bridge it against nothing on the host side and crashed with React's "incompatible react/react-dom versions" invariant instead of just using this plugin's own bundled copy.

Companion PR

datum-cloud/cloud-portal needs the matching host-side entry in federation-host.ts's hostShared() so this actually shares the host's instance instead of falling back to a local one — filing that now.

Test plan

  • bun run typecheck / bun run build pass
  • Confirm the chat dock renders without this error once both PRs are merged

React 19's createRoot/hydrateRoot live in this subpath, which Module
Federation treats as a distinct shared module from 'react-dom' rather
than folding it in automatically. One of this plugin's dependencies
imports it (confirmed present in the built remoteEntry.js as its own
shared chunk), but it was never declared in `shared`, so MF tried to
bridge it against nothing on the host side and crashed with React's
own "incompatible react/react-dom versions" invariant (error #527)
instead of just using this plugin's own bundled copy:

  [Module Federation] Failed to bridge external shared module
  "react-dom/client" Error: Minified React error #527

Companion cloud-portal PR adds the matching host-side entry to
federation-host.ts's hostShared() so this actually shares the host's
instance instead of falling back to a local one.
@kevwilliams
kevwilliams merged commit 586d381 into main Sep 11, 2026
5 checks passed
@kevwilliams
kevwilliams deleted the fix/share-react-dom-client branch September 11, 2026 22:19
kevwilliams added a commit to datum-cloud/cloud-portal that referenced this pull request Sep 11, 2026
## Summary
React 19's `createRoot`/`hydrateRoot` live in `react-dom/client`, which
Module Federation treats as its own distinct shared module from
`react-dom` rather than folding it in automatically. Without a host-side
entry, a plugin that imports it (transitively, via some UI dependency)
tries to "bridge" against nothing here and crashes with React's own
"incompatible react/react-dom versions" invariant instead of cleanly
falling back to its own copy — hit by the assistant plugin's chat dock:

\`\`\`
[Module Federation] Failed to bridge external shared module
"react-dom/client"
Error: Minified React error #527
\`\`\`

## Companion PR
[milo-os/assistant#83](milo-os/assistant#83)
adds the matching plugin-side `shared` declaration.

## Test plan
- [x] `bun run typecheck` passes
- [ ] Confirm the assistant plugin's chat dock renders without this
error once both PRs are merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants