Vue's Compiler Source-Map Rework Cuts CPU 30% and Fixes Wrong Line Numbers
Build and debug workflows get a real speedup and more accurate source maps, but tool authors who rely on `@vue/compiler-sfc`'s MagicString export will need to update before upgrading, since the change lands in a minor version, not a patch.
A PR in Vue's core repo, from core member johnsoncodehk, swaps the compiler's source-map generation from a parallel magic-string and source-map-js setup to a design where each generated code fragment carries its own source range. This eliminates the misalignment that plagued multi-line expressions, `v-for`, and `v-model`, where error stacks pointed at the wrong line, and fixes over a dozen reported line-mapping bugs across compiler packages.
Benchmarks from a single run of 1,297 `.vue` files on Node 24 / Apple Silicon show hot-start CPU dropping from 2,988 ms to 2,108 ms (29% down), cold start from 4,517 ms to 3,575 ms, memory falling roughly a third to 40%, and parse time dropping 37%. Retained heap after parsing fell from 113.4 MB to 42 MB. The `compiler-sfc` dependency tree shrinks from 12 to 11 packages, browser bundles shrink 5-8%, and `source-map-js` is removed from most compiler packages.
The change is breaking: `MagicString` is no longer exported from `@vue/compiler-sfc`, and it lands in a minor release, not a patch. Ecosystem tests show eight of sixteen suites red (nuxt, vue-i18n, vuetify, router), attributed to snapshot updates and the new dependency being too fresh for package manager release-age policies. The PR also fixes `await await foo()`, `await` inside macro args, and triple evaluation of `defineModel` options. Notably, many commits are co-authored by Cursor Agent, with humans reviewing and editing.
AI assistants are now writing substantive compiler code: many commits in this PR list Cursor Agent as a co-author, with humans reviewing and editing. That's a workflow shift in core OSS, not just a side project.
The architectural simplification from two parallel mapping systems to self-describing segments removes an entire class of line-number bugs; the performance gain is a side effect of deleting a whole bookkeeping layer.
The red ecosystem tests are largely due to snapshot updates and the new dependency being blocked by package managers' release-age policies, not necessarily regressions in the PR; that distinction matters when evaluating the change.
Benchmarks come from a single run on Apple Silicon with Node 24; they indicate a real improvement but aren't a rigorous cross-platform benchmark.