fix(retry-plugin): externalize runtime types from DTS bundle#4853
Conversation
🦋 Changeset detectedLatest commit: 3a8ef80 The changes in this PR will be included in the next version bump. This PR includes changesets to release 47 packages
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 |
✅ Deploy Preview for module-federation-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
💡 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".
ScriptedAlchemy
left a comment
There was a problem hiding this comment.
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.
@module-federation/devtools
@module-federation/cli
create-module-federation
@module-federation/dts-plugin
@module-federation/enhanced
@module-federation/error-codes
@module-federation/esbuild
@module-federation/managers
@module-federation/manifest
@module-federation/metro
@module-federation/metro-plugin-rnc-cli
@module-federation/metro-plugin-rnef
@module-federation/metro-plugin-rock
@module-federation/modern-js
@module-federation/modern-js-v3
@module-federation/native-federation-tests
@module-federation/native-federation-typescript
@module-federation/nextjs-mf
@module-federation/node
@module-federation/observability-plugin
@module-federation/playground
@module-federation/retry-plugin
@module-federation/rsbuild-plugin
@module-federation/rspack
@module-federation/rspress-plugin
@module-federation/runtime
@module-federation/runtime-core
@module-federation/runtime-tools
@module-federation/sdk
@module-federation/storybook-addon
@module-federation/third-party-dts-extractor
@module-federation/treeshake-frontend
@module-federation/treeshake-server
@module-federation/typescript
@module-federation/utilities
@module-federation/webpack-bundler-runtime
@module-federation/bridge-react
@module-federation/bridge-react-webpack-plugin
@module-federation/bridge-shared
@module-federation/bridge-vue3
@module-federation/inject-external-runtime-core-plugin
commit: |
c103676
into
module-federation:main
Description
@module-federation/retry-pluginwas not listing@module-federation/runtimeand@module-federation/runtime-corein the external array of itstsdown.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/runtimeand the inlined copy insideretry-plugin/dist/index.d.tsas 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/runtimeand@module-federation/retry-plugintogether.The fix adds
@module-federation/runtimeand@module-federation/runtime-coreto 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.0Types of changes
Checklist