Skip to content

fix: map default export bindings without source mappings - #337

Merged
sxzz merged 1 commit into
mainfrom
fix/default-export-sourcemap
Nov 2, 2026
Merged

sxzz merged 1 commit into
mainfrom
fix/default-export-sourcemap

Conversation

@sxzzbot

@sxzzbot sxzzbot commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator

AI usage

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

Description

For export default <expr> and export = <expr>, tsc and tsgo emit declare const _default: T and only map the export statement. The plugin drops that statement, so the .d.ts.map can end up with empty mappings.

A binding on a line without mappings now takes the position of its default export reference. The check uses the generator's map rather than the binding name, so oxc output and user-declared _default bindings keep their mappings.

Linked Issues

Fixes rolldown/tsdown#426
Closes #335

Additional context

Replaces #335, which overwrites existing mappings for oxc and user-declared _default bindings.

@pkg-pr-new

pkg-pr-new Bot commented Nov 2, 2026

Copy link
Copy Markdown

Open in StackBlitz

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

commit: e46370a

@sxzz
sxzz merged commit 877631e into main Nov 2, 2026
13 checks passed
@sxzz
sxzz deleted the fix/default-export-sourcemap branch November 2, 2026 04:59
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.

d.ts.map has empty mappings when directly exporting a property from an imported object

2 participants