Skip to content

fix(devtools): stop wiping source maps in dev - #9155

Merged
Varixo merged 5 commits into
QwikDev:mainfrom
Aejkatappaja:fix/devtools-sourcemaps
Nov 3, 2026
Merged

Varixo merged 5 commits into
QwikDev:mainfrom
Aejkatappaja:fix/devtools-sourcemaps

Conversation

@Aejkatappaja

Copy link
Copy Markdown
Member

Depends on #9153. This branch is stacked on it, so the first two commits are #9153's; only the last one is new here. I'll rebase once #9153 lands.

What is it?

  • Bug

Description

With qwikDevtools() enabled, every module served in dev loses its source map. The plugin's pre transform 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:

mappings length sources
without DevTools 152 ["layout.tsx"]
with DevTools, before 0 undefined
with DevTools, after 152 ["layout.tsx"]

The transform now returns null when it doesn't change the file, and map: null when 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 sourcesContent from what it receives. Lines are right everywhere.

Test: a Vite server running only the DevTools plugin checks that an untouched .ts file and an instrumented .tsx component both keep sources and non-empty mappings. It fails on main.

Checklist

  • My code follows the developer guidelines of this project
  • I performed a self-review of my own code
  • I added a changeset with pnpm change
  • I added new tests to cover the fix / functionality

@changeset-bot

changeset-bot Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f53ca40

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
@qwik.dev/devtools Patch
create-qwik Patch
eslint-plugin-qwik Patch
@qwik.dev/mcp Patch
@qwik.dev/react Patch
@qwik.dev/router Patch
@qwik.dev/utils Patch
@qwik.dev/core Patch

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

@pkg-pr-new

pkg-pr-new Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@qwik.dev/core

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/core@9155

@qwik.dev/router

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/router@9155

@qwik.dev/utils

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/utils@9155

eslint-plugin-qwik

npm i https://pkg.pr.new/QwikDev/qwik/eslint-plugin-qwik@9155

create-qwik

npm i https://pkg.pr.new/QwikDev/qwik/create-qwik@9155

@qwik.dev/optimizer

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/optimizer@9155

@qwik.dev/devtools

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/devtools@9155

@qwik.dev/mcp

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/mcp@9155

commit: f53ca40

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
Aejkatappaja force-pushed the fix/devtools-sourcemaps branch from d015eb3 to a136c67 Compare October 4, 2026 22:46
@Aejkatappaja
Aejkatappaja marked this pull request as ready for review October 13, 2026 10:29
@Aejkatappaja
Aejkatappaja requested a review from a team as a code owner October 13, 2026 10:29

@Varixo Varixo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@Varixo
Varixo merged commit 3d62043 into QwikDev:main Nov 3, 2026
54 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants