Skip to content

fix(repack): support Module Federation 2.x runtime plugins - #1484

Open
whydidoo wants to merge 4 commits into
callstack:mainfrom
whydidoo:fix/module-federation-2.9
Open

whydidoo wants to merge 4 commits into
callstack:mainfrom
whydidoo:fix/module-federation-2.9

Conversation

@whydidoo

@whydidoo whydidoo commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

While moving to MF 2.x I ran into two issues in Re.Pack:

  1. runtimePlugins entries in the [path, options] form (new in MF 2.x) were silently dropped. ModuleFederationPluginV2 passes each entry to require.resolve, which throws on an array, and the catch just ignores it. Now the path gets resolved and the options are kept.

  2. The typings for @callstack/repack/mf/* are broken on enhanced >= 0.17. MF renamed FederationRuntimePlugin -> ModuleFederationRuntimePlugin and FederationHost -> ModuleFederation there (no aliases), and our d.ts still imports the old names. Just renaming them would break anyone on older versions (peer is >=0.6.10), so the types are now derived from init(), which exists in every version.

Also bumped enhanced/sdk in repack devDeps to 2.9.2 and the testers catalog to match. They need to be in sync because ModuleFederationPluginV2 loads repack's own enhanced, so the tester apps were actually building with 0.8.9.

Peer range is unchanged.

Test plan

  • unit tests and typecheck pass, added a test for [path, options] (fails on main)
  • checked the emitted typings against enhanced 0.8.9 and 2.9.2 with skipLibCheck: false: plugin types resolve correctly in both, not any
  • ran tester-federation-v2 on the iOS sim: host and mini app both on runtime 2.9.2, gallery loads fine
  • went through the MF changelog 2.8 -> 2.9.2, nothing touches the hooks we use

- Keep runtime plugins passed to ModuleFederationPluginV2 as [path, options]; they were silently dropped before.
- Derive the runtime plugin types from `init`, so the
  @callstack/repack/mf/* typings work with @module-federation/enhanced before and after 0.17, which renamed FederationRuntimePlugin and FederationHost to ModuleFederationRuntimePlugin and ModuleFederation.
- Bump @module-federation/enhanced and sdk dev dependencies to 2.9.2, and enhanced and runtime in the testers catalog.
@changeset-bot

changeset-bot Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 02d66ae

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

This PR includes changesets to release 6 packages
Name Type
@callstack/repack Patch
@callstack/repack-plugin-expo-modules Patch
@callstack/repack-plugin-nativewind Patch
@callstack/repack-plugin-reanimated Patch
@callstack/repack-dev-server Patch
@callstack/repack-init 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

@vercel

vercel Bot commented Oct 9, 2026

Copy link
Copy Markdown

@whydidoo is attempting to deploy a commit to the Callstack Team on Vercel.

A member of the Team first needs to authorize it.

@dannyhw dannyhw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks, this looks good. I checked it locally: the unit and integration tests pass, the emitted mf/* typings resolve properly against enhanced 0.6.10, 0.8.9, 0.16, 0.17 and 2.9.2, and a tester-federation-v2 bundle with a [path, options] runtime plugin passes the options through to the plugin at runtime. One small nit inline, not blocking.

Comment thread packages/repack/src/plugins/ModuleFederationPluginV2.ts Outdated
@whydidoo
whydidoo requested a review from dannyhw October 9, 2026 19:47

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants