Skip to content

fix(retry-plugin): externalize runtime types from DTS bundle#4853

Merged
ScriptedAlchemy merged 3 commits into
module-federation:mainfrom
shashank-u03:fix/retry-plugin-bundle-runtime-types-inline
Jul 2, 2026
Merged

fix(retry-plugin): externalize runtime types from DTS bundle#4853
ScriptedAlchemy merged 3 commits into
module-federation:mainfrom
shashank-u03:fix/retry-plugin-bundle-runtime-types-inline

Conversation

@shashank-u03

Copy link
Copy Markdown
Contributor

Description

@module-federation/retry-plugin was not listing @module-federation/runtime and @module-federation/runtime-core in the external array of its tsdown.config.ts. As a result, the DTS bundler was inlining all type definitions from runtime-core directly into dist/index.d.ts instead of referencing them externally.

This caused TypeScript to treat ModuleFederationRuntimePlugin from @module-federation/runtime and the inlined copy inside retry-plugin/dist/index.d.ts as two different type origins — even though they are structurally identical — leading to errors like:

Type 'ModuleFederationRuntimePlugin' is not assignable to type 'ModuleFederationRuntimePlugin'

in any consumer that uses both @module-federation/runtime and @module-federation/retry-plugin together.

The fix adds @module-federation/runtime and @module-federation/runtime-core to the external array, matching the pattern already used by @module-federation/observability-plugin. This reduces dist/index.d.ts from 22.85 kB to 2.98 kB and eliminates the type incompatibility.

Related Issue

N/A — discovered while upgrading from @module-federation/retry-plugin@0.19.1 to 2.6.0

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have updated the documentation.

@changeset-bot

changeset-bot Bot commented Jun 28, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 3a8ef80

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

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

@netlify

netlify Bot commented Jun 28, 2026

Copy link
Copy Markdown

Deploy Preview for module-federation-docs ready!

Name Link
🔨 Latest commit 3a8ef80
🔍 Latest deploy log https://app.netlify.com/projects/module-federation-docs/deploys/6a45eaf4a1353e0008ab5145
😎 Deploy Preview https://deploy-preview-4853--module-federation-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@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: 0930f8e4b9

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread packages/retry-plugin/tsdown.config.ts

@ScriptedAlchemy ScriptedAlchemy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Verified end to end: built the branch and confirmed dist/index.d.ts now imports ModuleFederationRuntimePlugin from @module-federation/runtime instead of inlining the types (the source of the consumer type-incompatibility), while the JS bundles contain no runtime import (type-only usage is elided), so there is no runtime behavior change. runtime-core does not appear in the emitted d.ts, so the single @module-federation/runtime peer dependency is sufficient. Tests pass 16/16.

@pkg-pr-new

pkg-pr-new Bot commented Jul 2, 2026

Copy link
Copy Markdown

Open in StackBlitz

@module-federation/devtools

pnpm add https://pkg.pr.new/@module-federation/devtools@3a8ef80

@module-federation/cli

pnpm add https://pkg.pr.new/@module-federation/cli@3a8ef80

create-module-federation

pnpm add https://pkg.pr.new/create-module-federation@3a8ef80

@module-federation/dts-plugin

pnpm add https://pkg.pr.new/@module-federation/dts-plugin@3a8ef80

@module-federation/enhanced

pnpm add https://pkg.pr.new/@module-federation/enhanced@3a8ef80

@module-federation/error-codes

pnpm add https://pkg.pr.new/@module-federation/error-codes@3a8ef80

@module-federation/esbuild

pnpm add https://pkg.pr.new/@module-federation/esbuild@3a8ef80

@module-federation/managers

pnpm add https://pkg.pr.new/@module-federation/managers@3a8ef80

@module-federation/manifest

pnpm add https://pkg.pr.new/@module-federation/manifest@3a8ef80

@module-federation/metro

pnpm add https://pkg.pr.new/@module-federation/metro@3a8ef80

@module-federation/metro-plugin-rnc-cli

pnpm add https://pkg.pr.new/@module-federation/metro-plugin-rnc-cli@3a8ef80

@module-federation/metro-plugin-rnef

pnpm add https://pkg.pr.new/@module-federation/metro-plugin-rnef@3a8ef80

@module-federation/metro-plugin-rock

pnpm add https://pkg.pr.new/@module-federation/metro-plugin-rock@3a8ef80

@module-federation/modern-js

pnpm add https://pkg.pr.new/@module-federation/modern-js@3a8ef80

@module-federation/modern-js-v3

pnpm add https://pkg.pr.new/@module-federation/modern-js-v3@3a8ef80

@module-federation/native-federation-tests

pnpm add https://pkg.pr.new/@module-federation/native-federation-tests@3a8ef80

@module-federation/native-federation-typescript

pnpm add https://pkg.pr.new/@module-federation/native-federation-typescript@3a8ef80

@module-federation/nextjs-mf

pnpm add https://pkg.pr.new/@module-federation/nextjs-mf@3a8ef80

@module-federation/node

pnpm add https://pkg.pr.new/@module-federation/node@3a8ef80

@module-federation/observability-plugin

pnpm add https://pkg.pr.new/@module-federation/observability-plugin@3a8ef80

@module-federation/playground

pnpm add https://pkg.pr.new/@module-federation/playground@3a8ef80

@module-federation/retry-plugin

pnpm add https://pkg.pr.new/@module-federation/retry-plugin@3a8ef80

@module-federation/rsbuild-plugin

pnpm add https://pkg.pr.new/@module-federation/rsbuild-plugin@3a8ef80

@module-federation/rspack

pnpm add https://pkg.pr.new/@module-federation/rspack@3a8ef80

@module-federation/rspress-plugin

pnpm add https://pkg.pr.new/@module-federation/rspress-plugin@3a8ef80

@module-federation/runtime

pnpm add https://pkg.pr.new/@module-federation/runtime@3a8ef80

@module-federation/runtime-core

pnpm add https://pkg.pr.new/@module-federation/runtime-core@3a8ef80

@module-federation/runtime-tools

pnpm add https://pkg.pr.new/@module-federation/runtime-tools@3a8ef80

@module-federation/sdk

pnpm add https://pkg.pr.new/@module-federation/sdk@3a8ef80

@module-federation/storybook-addon

pnpm add https://pkg.pr.new/@module-federation/storybook-addon@3a8ef80

@module-federation/third-party-dts-extractor

pnpm add https://pkg.pr.new/@module-federation/third-party-dts-extractor@3a8ef80

@module-federation/treeshake-frontend

pnpm add https://pkg.pr.new/@module-federation/treeshake-frontend@3a8ef80

@module-federation/treeshake-server

pnpm add https://pkg.pr.new/@module-federation/treeshake-server@3a8ef80

@module-federation/typescript

pnpm add https://pkg.pr.new/@module-federation/typescript@3a8ef80

@module-federation/utilities

pnpm add https://pkg.pr.new/@module-federation/utilities@3a8ef80

@module-federation/webpack-bundler-runtime

pnpm add https://pkg.pr.new/@module-federation/webpack-bundler-runtime@3a8ef80

@module-federation/bridge-react

pnpm add https://pkg.pr.new/@module-federation/bridge-react@3a8ef80

@module-federation/bridge-react-webpack-plugin

pnpm add https://pkg.pr.new/@module-federation/bridge-react-webpack-plugin@3a8ef80

@module-federation/bridge-shared

pnpm add https://pkg.pr.new/@module-federation/bridge-shared@3a8ef80

@module-federation/bridge-vue3

pnpm add https://pkg.pr.new/@module-federation/bridge-vue3@3a8ef80

@module-federation/inject-external-runtime-core-plugin

pnpm add https://pkg.pr.new/@module-federation/inject-external-runtime-core-plugin@3a8ef80

commit: 3a8ef80

@ScriptedAlchemy ScriptedAlchemy merged commit c103676 into module-federation:main Jul 2, 2026
34 of 38 checks passed
@2heal1 2heal1 mentioned this pull request Jul 8, 2026
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.

2 participants