You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would expect that if I enabled declaration maps (either from the tsdown config or the tsconfig), I would get declaration maps. I would expect that source maps would stay disabled. E.g.:
tsdown.config
{sourcemap: false,dts: {sourcemap: true,},}
What is actually happening?
Enabling declaration maps also implicitly enables source maps.
Explicitly DISABLING source maps still doesn't disable them.
Any additional comments?
Declaration maps and source maps serve different purposes. TS lets you enable one and not the other (or both) for that reason, so I would expect tsdown to do the same. The toggle should be independent.
If tsdown can't support that for whatever reason, that's fine, that isn't the end of the world, but this problem should be more discoverable. It took me a really long time to binary chop the problem and discover that I was getting source maps because my shared tsconfig had "declarationMap": true.
Thank you in advance for taking a look at this bug!
Thanks for the report, and sorry it took so long to track down. This is a real limitation, but it can't be fixed properly in tsdown or rolldown-plugin-dts right now.
output.sourcemap applies to the whole output in Rolldown, and Rolldown has no per-chunk source map control. To generate declaration maps, rolldown-plugin-dts has to turn it on for the entire output, so JS source maps are generated as well.
We looked at removing the JS maps afterwards in generateBundle (sxzz/rolldown-plugin-dts#334), but decided against it. It can delete .map files emitted by other plugins, drop JS maps that were explicitly requested in multi-output builds, and strip maps enabled by later plugins. That's a worse failure than an extra .js.map.
We're treating this as a feature request: independent declaration maps need per-chunk source map support in Rolldown.
For now, there are two workarounds:
If you don't need declaration maps, set dts: { sourcemap: false } or disable declarationMap in your tsconfig.
If you need declaration maps but don't want to publish JS maps, exclude them from the package, for example with "!dist/**/*.{js,mjs}.map" in files. The sourceMappingURL comment will stay in the JS files.
Activity
sxzzbot commentedon Nov 2, 2026
Thanks for the report, and sorry it took so long to track down. This is a real limitation, but it can't be fixed properly in tsdown or rolldown-plugin-dts right now.
output.sourcemapapplies to the whole output in Rolldown, and Rolldown has no per-chunk source map control. To generate declaration maps, rolldown-plugin-dts has to turn it on for the entire output, so JS source maps are generated as well.We looked at removing the JS maps afterwards in
generateBundle(sxzz/rolldown-plugin-dts#334), but decided against it. It can delete.mapfiles emitted by other plugins, drop JS maps that were explicitly requested in multi-output builds, and strip maps enabled by later plugins. That's a worse failure than an extra.js.map.We're treating this as a feature request: independent declaration maps need per-chunk source map support in Rolldown.
For now, there are two workarounds:
dts: { sourcemap: false }or disabledeclarationMapin your tsconfig."!dist/**/*.{js,mjs}.map"infiles. ThesourceMappingURLcomment will stay in the JS files.