Skip to content

fix(dts): respect custom dts extension in dts-only builds - #379

Open
danielroe wants to merge 1 commit into
sxzz:mainfrom
danielroe:fix/dts-only-out-extension
Open

danielroe wants to merge 1 commit into
sxzz:mainfrom
danielroe:fix/dts-only-out-extension

Conversation

@danielroe

Copy link
Copy Markdown
Contributor

AI usage

  • No AI was used in this PR.
  • AI was used: DeepSeek v4 Pro
    • I have carefully reviewed the AI-generated content myself.

Description

tsdown dts-only builds with outExtensions: () => ({ dts: '.d.ts' }) regressed in 0.30

two entries sharing a module now emit cache.d.mts and error-shape.d.d.ts (imported as ./error-shape.d.js), where 0.29.0-beta.2 emitted cache.d.ts and error-shape.d.ts (imported as ./error-shape.js). see nuxt/nuxt#37225.

this seems to be because the dtsOnly merge in #340 changed how dts chunks are named.

this PR resolves the naming function against a .d-suffixed chunk name and strips the .d before substituting [name], the way regular builds name dts chunks.

repro
// cache.ts and event.ts
export { type ErrorShape, errorShape } from './error-shape'
// error-shape.ts
export interface ErrorShape { message: string }
export const errorShape: ErrorShape = { message: 'error' }

built with dts({ dtsOnly: true }), preserveModules: true, and entry/chunk file name functions returning [name].d.ts for .d chunks and [name].mjs otherwise.

Linked Issues

Additional context

@pkg-pr-new

pkg-pr-new Bot commented Nov 23, 2026

Copy link
Copy Markdown

Open in StackBlitz

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

commit: f3f2c78

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.

1 participant