Fix SOURCEMAP_BROKEN warnings: return an empty sourcemap from the transform hook - #12
Merged
evoactivity merged 1 commit intoJul 28, 2026
Conversation
…nsform hook
The transform hook returned bare strings, so bundlers building with
sourcemaps enabled (rolldown/tsdown, rollup, vite build) warned
SOURCEMAP_BROKEN once per imported SVG. The transform replaces each SVG
module's code wholesale, so there is no meaningful mapping back to the
source: return { code, map: { mappings: '' } } per the Rollup convention.
The tsdown example project now builds with sourcemap: true, and its
integration test asserts the build output contains no SOURCEMAP_BROKEN.
The tsdown catalog entry is bumped to ^0.22.9 because the warning only
surfaces on current rolldown (1.2.x), not the 1.0.0-rc line.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
|
looks like tsdown 0.22.x drops supports for node 20 can you get the bot to drop node 20 from the matrix and add node 26? |
Contributor
Author
|
faster for me to do that one by hand #13 <3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
This PR was made with Claude (AI) — apologies in advance if anything here misses the mark; happy to adjust or split it up however you prefer.
Problem
The
transformhook returns bare strings. Any bundler building with sourcemaps enabled (rolldown/tsdown, rollup, vite build) then warns once per imported SVG:In an icon-heavy library that's dozens of warnings per build.
Fix
The transform replaces each SVG module's code wholesale, so there is no meaningful mapping back to the source. Per the Rollup convention, the hook now returns
{ code, map: { mappings: '' } }— an explicitly empty sourcemap — instead of a bare string.Test
Test-first, in the tsdown example project:
test-projects/tsdown/internal-packagenow builds withsourcemap: trueSOURCEMAP_BROKEN— red before the fix (3 warnings, one per SVG import), green aftertsdowncatalog entry is bumped^0.21.8→^0.22.9: the warning only surfaces on current rolldown (1.2.x), not the 1.0.0-rc line the catalog previously resolved to. The lockfile churn beyond tsdown is transitive fallout from that re-resolution.🤖 Generated with Claude Code