Repository navigation
fix: Generate missing sourcemap in wxt:unimport plugin - #381
Merged
Merged
Conversation
✅ Deploy Preview for creative-fairy-df92c4 ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #381 +/- ##
==========================================
- Coverage 80.16% 80.04% -0.13%
==========================================
Files 104 104
Lines 7528 7532 +4
Branches 679 677 -2
==========================================
- Hits 6035 6029 -6
- Misses 1477 1487 +10
Partials 16 16 ☔ View full report in Codecov by Sentry. |
aklinker1
marked this pull request as ready for review
January 29, 2024 16:24
This was referenced Aug 29, 2026
zizzfizzix
pushed a commit
to zizzfizzix/wxt
that referenced
this pull request
Aug 29, 2026
`unimport/unplugin` calls `MagicString#generateMap()` with no options, which produces a line-level sourcemap with no `source`. Since auto-imports are injected at the top of the file, tools that rely on columns - like V8 code coverage - see the whole module as a single statement. The result is that any module referencing an auto-imported variable (`browser`, `storage`, ...) silently drops out of coverage reports, which inflates the reported percentage and lets thresholds pass when they shouldn't. This was fixed once in wxt-dev#381, but wxt-dev#1412 replaced the `wxt:unimport` plugin with `UnimportPlugin.vite()` in both the build path and `WxtVitest()`, dropping the `hires` option along the way. Restore the `wxt:unimport` plugin with the sourcemap options from wxt-dev#381, keeping the `enforce: 'post'` ordering and the include/exclude filter that wxt-dev#1412 relied on. The defaults are imported from `unimport/unplugin`, so they can't drift. Both the build path and `WxtVitest()` share the plugin. Fixes wxt-dev#2604 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_011PEx8LKp7AtQkR3tJfyFrY
zizzfizzix
pushed a commit
to zizzfizzix/wxt
that referenced
this pull request
Aug 29, 2026
`unimport/unplugin` calls `MagicString#generateMap()` with no options, which produces a line-level sourcemap with no `source`. Since auto-imports are injected at the top of the file, tools that rely on columns - like V8 code coverage - see the whole module as a single statement. The result is that any module referencing an auto-imported variable (`browser`, `storage`, ...) silently drops out of coverage reports, which inflates the reported percentage and lets thresholds pass when they shouldn't. This was fixed once in wxt-dev#381, but wxt-dev#1412 replaced the `wxt:unimport` plugin with `UnimportPlugin.vite()` in both the build path and `WxtVitest()`, dropping the `hires` option along the way. Restore the `wxt:unimport` plugin with the sourcemap options from wxt-dev#381, keeping the `enforce: 'post'` ordering and the include/exclude filter that wxt-dev#1412 relied on. The defaults are imported from `unimport/unplugin`, so they can't drift. Both the build path and `WxtVitest()` share the plugin. Fixes wxt-dev#2604 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_011PEx8LKp7AtQkR3tJfyFrY
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.
Apart of #236, addresses issue with
wxt:unimportplugin transforming code, but not providing sourcemaps for the transformed code.