-
-
Notifications
You must be signed in to change notification settings - Fork 358
Description
Describe the bug
When running rspack dev
or rspack build
in the rspack-header
app the Module Federation DTS plugin fails to generate type declarations and prints an error that suggests running tsc
against a generated tsconfig in node_modules/.federation
. The build still completes, but DTS files are not produced and the plugin logs an exception.
If i run the suggested npx command externally, it generates the dts in the diist folder.
Repository files to inspect
- rspack-header/package.json
- rspack-header/rspack.config.ts — references
mfConfig
- rspack-header/module-federation.config.ts — uses
createModuleFederationConfig
- rspack-header/tsconfig.json
- rspack-header/src/Header.tsx (exposed module)
Steps to reproduce
- Clone repo and install deps.
- cd rspack-header
- Run:
npm run dev
(orrspack dev
) ornpm run build
(orrspack build
)
Observed output :
rspack dev
[webpack-dev-server] Project is running at:
[webpack-dev-server] Loopback: http://localhost:5001/, http://[::1]:5001/
[webpack-dev-server] On Your Network (IPv4): http://10.5.0.2:5001/
[webpack-dev-server] Content not from webpack is served from 'D:\Work\MF2\rspack-header\public' directory
● ━━━━━━━━━━━━━━━━━━━━━━━━━ (93%) sealing asset processing [Module Federation Manifest Plugin] [ Module Federation Manifest Plugin ] Manifest Link: http://localhost:5001/mf-manifest.json
● ━━━━━━━━━━━━━━━━━━━━━━━━━ (100%) emitting after emit Rspack compiled successfully in 2.42 s
[ Module Federation DTS ] Error: Failed to generate type declaration. Execute the below cmd to reproduce and fix the error. #TYPE-001
args: {"cmd":"npx tsc --project 'D:\Work\MF2\rspack-header\node_modules\.federation\tsconfig.f7e9768d17430ded7cb2374f1d0fd6f7.json'"}
View the docs to see how to solve: https://module-federation.io/guide/troubleshooting/type/TYPE-001
at D:\Work\MF2\rspack-header\node_modules@module-federation\dts-plugin\dist\fork-generate-dts.js:416:13
at Generator.throw ()
at rejected (D:\Work\MF2\rspack-header\node_modules@module-federation\dts-plugin\dist\fork-generate-dts.js:73:29)
Reproduction
https://github.com/danieleforte92/rspack-mf-provider
Used Package Manager
npm
System Info
System:
OS: Windows 11 10.0.26100
CPU: (12) x64 AMD Ryzen 5 5600X 6-Core Processor
Memory: 5.93 GB / 15.93 GB
Binaries:
Node: 22.17.1 - C:\nvm4w\nodejs\node.EXE
npm: 10.9.2 - C:\nvm4w\nodejs\npm.CMD
pnpm: 9.6.0 - C:\Users\danie\AppData\Local\pnpm\pnpm.EXE
bun: 1.2.2 - C:\Users\danie\AppData\Roaming\npm\bun.CMD
Browsers:
Chrome: 141.0.7390.66
Edge: Chromium (140.0.3485.54)
Internet Explorer: 11.0.26100.1882
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.