Repository navigation
fix(devtools): stop wiping source maps in dev - #9155
Merged
Merged
Conversation
🦋 Changeset detectedLatest commit: f53ca40 The changes in this PR will be included in the next version bump. This PR includes changesets to release 8 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@qwik.dev/core
@qwik.dev/router
@qwik.dev/utils
eslint-plugin-qwik
create-qwik
@qwik.dev/optimizer
@qwik.dev/devtools
@qwik.dev/mcp
commit: |
The DevTools transform returned an empty map for every module, so Vite dropped the source map of every file once the plugin was on. Return nothing for untouched files and a null map for instrumented ones, whose lines no longer move.
Aejkatappaja
force-pushed
the
fix/devtools-sourcemaps
branch
from
October 4, 2026 22:46
d015eb3 to
a136c67
Compare
Aejkatappaja
marked this pull request as ready for review
October 13, 2026 10:29
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.
What is it?
Description
With
qwikDevtools()enabled, every module served in dev loses its source map. The plugin'spretransform returned{ code, map: { mappings: '' } }for every file it saw, including the ones it doesn't touch, and Vite chains that empty map into the final one. Breakpoints in the original source stop working and browser stack traces point at the compiled output.Measured with
server.transformRequest('/src/routes/layout.tsx')on a Router SSR app:mappingslengthsources["layout.tsx"]undefined["layout.tsx"]The transform now returns
nullwhen it doesn't change the file, andmap: nullwhen it instruments it. A null map tells Vite the positions didn't change, which holds since #9153 keeps every line where it was. MCP's transform and DevTools' own statistics plugin already do the same.One limit: on lines that get an injection (the component's opening line, line 1 for the imports, a hook's line) the columns are still shifted, and the browser's source view shows the instrumented code rather than the original, since the optimizer builds
sourcesContentfrom what it receives. Lines are right everywhere.Test: a Vite server running only the DevTools plugin checks that an untouched
.tsfile and an instrumented.tsxcomponent both keepsourcesand non-emptymappings. It fails on main.Checklist
pnpm change