Description
With sourcemap: true and dts: true (no dts.sourcemap), tsdown appends //# sourceMappingURL=<name>.d.*.map to generated declaration files but does not emit the referenced map — the published tarball ships a comment that resolves to a missing file.
Reproduction
// tsdown.config.ts
export default defineConfig({
entry: ['src/index.ts'],
format: 'esm',
dts: true,
sourcemap: true,
})
pnpm build produces dist/index.d.mts ending in //# sourceMappingURL=index.d.mts.map while dist/index.d.mts.map does not exist.
Observed with tsdown 0.23.0.
Expected
Either don't append the comment when no declaration map is written, or write the map. (Note: dts: { sourcemap: true } writes maps whose sources point at ../src/*.ts without sourcesContent, which also doesn't resolve for consumers installing from a tarball — a separate but related gap.)
Workaround
Post-build strip of the trailing comment.