Skip to content

fix: remove runtime chunk only used by dts chunks - #329

Merged
sxzz merged 1 commit into
mainfrom
fix/remove-dts-only-runtime-chunk
Oct 28, 2026
Merged

sxzz merged 1 commit into
mainfrom
fix/remove-dts-only-runtime-chunk

Conversation

@sxzz

@sxzz sxzz commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

AI usage

  • No AI was used in this PR.
  • AI was used: Claude Code + Opus 5.5
    • I have carefully reviewed the AI-generated content myself.

Description

With preserveModules (tsdown's unbundle), a type like keyof typeof import('./mod') makes the dts chunk import rolldown's runtime (__exportAll). The helper import is stripped from the dts output, so if no JS chunk uses the runtime, _virtual/_rolldown/runtime.js is emitted as an orphan file.

This removes a runtime-only chunk in generateBundle when it has importers and all of them are dts chunks. Runtime chunks used by JS are kept.

Linked Issues

Closes rolldown/tsdown#379

Additional context

@pkg-pr-new

pkg-pr-new Bot commented Oct 28, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/sxzz/rolldown-plugin-dts@329

commit: 71dcc0e

@pkg-pr-new

pkg-pr-new Bot commented Oct 28, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/sxzz/rolldown-plugin-dts@329

commit: 71dcc0e

@sxzz
sxzz merged commit 957095f into main Oct 28, 2026
14 checks passed
@sxzz
sxzz deleted the fix/remove-dts-only-runtime-chunk branch October 28, 2026 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

unbundle: true generates unexpected virtual runtime file when using typeof import() in exported types

2 participants