Skip to content
Source
Sign inSign up
TanStack/router

fix(router-plugin): point split routes' source maps at the route file #8860

MergedSheraff(GitHub profile, opens in a new tab)merged 3 commits intomain fromrefs/pull/8860/headmerged by Sheraff(GitHub profile, opens in a new tab)

Showing 5 changed files with 9 additions and 2 deletions (loading 2).

x
0 of 5 viewed, 5 left
5 additions and 0 deletions.changeset/router-plugin-split-source-maps.mdAdded
View file
@@ -0,0 +1,5 @@
+---
+'@tanstack/router-plugin': patch
+---
+​
+Source maps of split routes now point at the route file. On webpack and Rspack (including Rsbuild), a split component or shared code mapped to the wrong line, because unplugin's loader dropped the router plugin's map; `unplugin` now requires `^3.5.0`, which keeps it. The maps of split and shared modules also name the route file itself instead of its `?tsr-split` / `?tsr-shared` module id, so debuggers bind breakpoints set in the route file.
4 additions and 2 deletionspackages/router-plugin/src/core/code-splitter/compilers.tsModified
View file
@@ -1285,7 +1285,8 @@
const result = generateFromAst(ast, {
sourceMaps: true,
- sourceFileName: opts.filename,
+ // Name the route file, not this module's `?tsr-*` id.
+ sourceFileName: removeSplitSearchParamFromFilename(opts.filename),
filename: opts.filename,
@@ -1376,7 +1377,8 @@
const result = generateFromAst(ast, {
sourceMaps: true,
- sourceFileName: opts.filename,