Skip to content

fix(tanstackstart-react): Unminify server errors in Nitro builds - #25360

Open
s1gr1d wants to merge 9 commits into
developfrom
sig/tanstack-start-source-maps
Open

s1gr1d wants to merge 9 commits into
developfrom
sig/tanstack-start-source-maps

Conversation

@s1gr1d

@s1gr1d s1gr1d commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

Server errors in TanStack Start stayed minified: Nitro's source maps were off, or stopped at its intermediate SSR bundle in node_modules/.nitro.

  • Loads the SSR source maps into Nitro's build, so the final maps point to src/.
  • Turns on 'hidden' Nitro source maps only if no config sets them, and always keeps sourcesContent (sourcemapMinify: false).
  • Deletes the Nitro source maps that Sentry turned on after the upload.

Nuxt 5 has the same Nitro issues: #25325 fixes sourcesContent, and the map composition can be reused there.

Based on #24356 by @kyrylolvov. Stacked on #25362.

Fixes #21012

s1gr1d and others added 3 commits October 14, 2026 13:53
TanStack Start splits route files into virtual modules such as `index.tsx?tss-serverfn-split`.
The uploaded source maps kept these queries and paths relative to the map's directory, so frames
did not show the path of the source file.

Remove the split queries and make source paths relative to the project root, so frames show paths
such as `src/routes/index.tsx`. A user's `sourcemaps.rewriteSources` still takes precedence.
…bled

The default `filesToDeleteAfterUpload: ['./**/*.map']` does not enter dot directories like
`.output`, so source maps that Sentry enabled stayed in the client build of Nitro apps.

Delete the source maps in the output directory of each environment that only has source maps
because Sentry enabled them. Keep source maps that the user enabled with `build.sourcemap`, an
environment setting or `build.rolldownOptions.output.sourcemap`. Warn on Vite 7, where Sentry
only knows `build.outDir`.
Server errors in TanStack Start stayed minified. Sentry did not turn on Nitro's source
maps, and Nitro's maps stopped at its intermediate SSR bundle in `node_modules/.nitro`.

Load the SSR source maps into Nitro's build, so the final maps point to `src/`. Turn on
'hidden' Nitro source maps only if no Vite or Nitro config sets them, and always set
`sourcemapMinify: false` to keep `sourcesContent`. Delete the Nitro source maps that Sentry
turned on after the upload.

Fixes #21012
Co-Authored-By: kyrylolvov <kyrylolvov@icloud.com>
@s1gr1d
s1gr1d force-pushed the sig/tanstack-start-source-maps branch from a0e6667 to a58eeb9 Compare October 14, 2026 11:55
@s1gr1d
s1gr1d changed the base branch from develop to sig/tanstack-start-delete-source-maps October 14, 2026 11:56
@s1gr1d
s1gr1d marked this pull request as ready for review October 14, 2026 11:58
@s1gr1d
s1gr1d requested a review from a team as a code owner October 14, 2026 11:58
@s1gr1d
s1gr1d requested review from chargome and mydea and removed request for a team October 14, 2026 11:58
@s1gr1d
s1gr1d requested a review from nicohrubec October 14, 2026 12:01
Credit @kyrylolvov for #24356, which this fix is based on.
@s1gr1d

s1gr1d commented Oct 14, 2026

Copy link
Copy Markdown
Member Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 38a674a. Configure here.

…layers

Sentry reads Nitro's config sources from the internal `_c12` option. Link the issue that asks
Nitro to expose them, so the code can move to the public option later.
…-delete-source-maps

# Conflicts:
#	packages/tanstackstart-react/src/vite/sourceMaps.ts
@s1gr1d
s1gr1d added this pull request to stack #25439 October 16, 2026 08:29
In debug mode, log that no source maps are deleted after the upload when Sentry did not enable
source map generation for the build. Before, debug mode logged nothing in this case.
Base automatically changed from sig/tanstack-start-delete-source-maps to develop October 16, 2026 12:13

This branch has not been deployed

No deployments
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.

tanstack-start: source maps support for server code

1 participant