Skip to content

emitDtsOnly breaks transitive module traversal, so dependent files may not emit .d.ts #231

@rzzf

Description

@rzzf

Reproduction link or steps

https://github.com/rzzf/dts-repro

Describe the bug

When rolldown-plugin-dts is used with Rolldown and emitDtsOnly: true, the plugin replaces transformed source modules with an empty stub:

export {}

This makes Rolldown stop traversing transitive dependencies from that module.

As a result, a simple chain like:

index.ts -> a.ts -> b.ts

can produce declarations only for index.ts and a.ts, while b.ts is omitted, even though a.ts imports b.ts.

In contrast, unplugin-dts emits all three declaration files in the same repro.

Actual output

Generated:

  • index.d.ts
  • a.d.ts

Missing:

  • b.d.ts

In a medium-to-large project, there are roughly 1,000 .ts / .tsx / .vue source files matching the full-input pattern. If all of them are passed to Rolldown as input, rolldown-plugin-dts becomes significantly slower and the DTS build time grows substantially.

Are there any other ways to solve this issue besides adding these files to the input?

System Info

System:
    OS: macOS 15.7.3
    CPU: (10) arm64 Apple M4
    Memory: 88.08 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 24.14.0 - /usr/local/bin/node
    npm: 11.9.0 - /usr/local/bin/npm
    pnpm: 10.28.2 - /usr/local/bin/pnpm
  Browsers:
    Chrome: 147.0.7727.117
    Safari: 18.6

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.

Contributions

  • I am willing to submit a PR to fix this issue
  • I am willing to submit a PR with failing tests (actually just go ahead and do it, thanks!)

Compensating engineering work will speed up resolution and support the project

  • I'm willing to offer $16 for financial support

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions