-
-
Notifications
You must be signed in to change notification settings - Fork 385
Description
Describe the bug
@module-federation/rsbuild-plugin / dts-plugin crashes when dts.consumeTypes = false: “moduleFederationConfig is required” + TypeError on moduleServer.exit()
Context
I’m using Module Federation with Rsbuild via pluginModuleFederation in a remote project.
I enable federated types generation.
As soon as I set dts.consumeTypes to false, the MF DTS worker crashes with moduleFederationConfig is required, then throws a TypeError while handling the unhandled rejection.
Versions / Environment
Node: v20.15.0
@module-federation/rsbuild-plugin: ^0.22.0
@rsbuild/core: 1.7.2
TypeScript: ^5.7.3
OS: macOS
Steps to reproduce
Configure pluginModuleFederation with dts: { generateTypes: true }
Set consumeTypes: false
Run rsbuild dev
Observed behavior
The DTS worker crashes:
Error: moduleFederationConfig is required
at validateOptions (.../node_modules/@module-federation/dts-plugin/dist/fork-dev-worker.js:2299:11)
Then:
TypeError: Cannot read properties of undefined (reading 'exit')
at .../fork-dev-worker.js:2865:18 (moduleServer.exit())
Expected behavior
With consumeTypes: false, the plugin should simply not attempt to consume types, without requiring a host config (moduleFederationConfig) and without crashing.
At minimum: no crash (no TypeError), and a clear actionable error if additional configuration is actually required.
Reproduction
https://github.com/Sanch0ous/module-federation-core-issue-dts
Used Package Manager
npm
System Info
System:
OS: macOS 26.0.1
CPU: (11) arm64 Apple M3 Pro
Memory: 106.58 MB / 18.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.15.0 - /usr/local/bin/node
Yarn: 1.22.22 - /usr/local/bin/yarn
npm: 11.6.0 - /Users/xxxxxxx/project/node_modules/.bin/npm
pnpm: 8.15.4 - /usr/local/bin/pnpm
Browsers:
Chrome: 143.0.7499.193
Firefox: 144.0.2
Safari: 26.0.1Validations
- 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.