Skip to content

DTS generation fails (#TYPE-001) when running rspack dev / rspack build #4133

@danieleforte92

Description

@danieleforte92

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

Steps to reproduce

  1. Clone repo and install deps.
  2. cd rspack-header
  3. Run: npm run dev (or rspack dev) or npm run build (or rspack 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions