Skip to content

[Bug]: Error with dts bundle enabled with multiple tsconfig includes #385

@friday

Description

@friday

Version

System:
OS: Linux 6.11 Arch Linux
CPU: (16) x64 AMD Ryzen 7 5800U with Radeon Graphics
Memory: 2.49 GB / 13.50 GB
Container: Yes
Shell: 3.7.1 - /usr/bin/fish
Browsers:
Brave Browser: 130.1.71.121
Chromium: 130.0.6723.116
npmPackages:
@rslib/core: ^0.0.15 => 0.0.15

Details

I tried to simplify the setup as much as possible, and ended up left with this:

With dts bundle enabled, a global type definition dependency with a monorepo setup, the build fails with a message that "path does not exist" .rslib/declarations/src/index.d.ts, (but the path .rslib/declarations/index.d.ts does exist).

I suspect the most relevant part is the tsconfig "include": ["src", "node_modules/@types"]? If uninstall the type package (which I'm not even using in this simplified repo) it works, probably because then "src" is consistently treated as the root path?

> rslib build

  Rslib v0.0.15

ready   Built in 0.04 s (esm)

  File (esm)       Size       Gzip    
  dist/index.js    0.09 kB    0.09 kB

  Total: 0.09 kB (gzip: 0.09 kB)

start   Generating DTS... (esm)
ready   DTS generated in 0.53 s (esm)
error   API Extractor Error
error   Error: Error parsing the configuration object:
The "mainEntryPointFilePath" path does not exist: /home/albin/src/personal/rslib-dts-bug-repro-monorepo/packages/package/.rslib/declarations/src/index.d.ts
    at bundleDts (file:///home/albin/src/personal/rslib-dts-bug-repro-monorepo/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected]/node_modules/rsbuild-plugin-dts/dist/apiExtractor.js:40:15)
    at bundleDtsIfNeeded (file:///home/albin/src/personal/rslib-dts-bug-repro-monorepo/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected]/node_modules/rsbuild-plugin-dts/dist/dts.js:84:19)
    at async generateDts (file:///home/albin/src/personal/rslib-dts-bug-repro-monorepo/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected]/node_modules/rsbuild-plugin-dts/dist/dts.js:116:19)
    at async process.<anonymous> (file:///home/albin/src/personal/rslib-dts-bug-repro-monorepo/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected]/node_modules/rsbuild-plugin-dts/dist/dts.js:121:9)
error   Failed to build.
error   Error occurred in esm DTS generation
    at handler (file:///home/albin/src/personal/rslib-dts-bug-repro-monorepo/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected]/node_modules/rsbuild-plugin-dts/dist/index.js:61:57)
    at Object.call (file:///home/albin/src/personal/rslib-dts-bug-repro-monorepo/node_modules/.pnpm/@[email protected]/node_modules/@rsbuild/core/dist/index.js:5445:28)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async onDone (file:///home/albin/src/personal/rslib-dts-bug-repro-monorepo/node_modules/.pnpm/@[email protected]/node_modules/@rsbuild/core/dist/index.js:5613:9)
    at async Object.fn (file:///home/albin/src/personal/rslib-dts-bug-repro-monorepo/node_modules/.pnpm/@[email protected]/node_modules/@rsbuild/core/dist/index.js:5572:11)
/home/albin/src/personal/rslib-dts-bug-repro-monorepo/packages/package:
 ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL  @test/[email protected] build: `rslib build`
Exit status 1
 ELIFECYCLE  Command failed with exit code 1.

Reproduce link

https://github.com/friday/rslib-dts-bundle-bug

Reproduce Steps

  1. Check out the repo link and install pnpm
  2. Run pnpm install or pnpm i to install the dependencies
  3. Run pnpm run build

Metadata

Metadata

Assignees

Labels

🐞 bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions