Description
Describe the bug
The types of dynamic remotes is not fetched by the host.
I have a small project inspired by something I’m working on at my company. It has a host that uses two remotes:
- The
remote1
is a dynamic remote - The
remote2
is a static remote (its config is defined inside webpack.config.js)
And the types for the remote1
(the dynamic one) are not fetched.
I was able to reproduce the same behavior in one of your projects in the apps
folder > https://github.com/module-federation/core/tree/main/apps/runtime-demo
I dug a little bit into the code and it seems the bug was introduced by this change: #3629
Indeed, normally if it should consume type, the DevPlugin
will add dynamic-remote-type-hints-plugin.js
plugin (https://github.com/module-federation/core/blob/main/packages/dts-plugin/src/plugins/DevPlugin.ts#L149) to runtimePlugins
via the options
object.
However, with the change mentioned above, the options object is now cloned, so the dynamic-remote-type-hints
plugin is no longer loaded.
Let me know if you want this reworded further or need a more formal/shorter version!
Reproduction
https://github.com/msalettes/poc-module-federation-v2
Used Package Manager
yarn
System Info
System:
OS: macOS 15.4.1
CPU: (10) arm64 Apple M1 Pro
Memory: 79.73 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.14.0 - ~/.volta/tools/image/node/22.14.0/bin/node
Yarn: 1.22.19 - ~/.volta/tools/image/yarn/1.22.19/bin/yarn
npm: 10.9.2 - ~/.volta/tools/image/node/22.14.0/bin/npm
pnpm: 10.6.5 - ~/.volta/bin/pnpm
bun: 1.0.3 - ~/.bun/bin/bun
Browsers:
Chrome: 135.0.7049.115
Safari: 18.4
Validations
- Read the docs.
- Read the common issues list.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Module federation issue and not a framework-specific issue.
- The provided reproduction is a minimal reproducible example of the bug.