Repository navigation
fix(tanstackstart-react): Delete only the source maps that Sentry enabled - #25362
Conversation
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`.
|
bugbot run |
There was a problem hiding this comment.
✅ 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 2f5889c. Configure here.
JPeer264
left a comment
There was a problem hiding this comment.
q: Wouldn't it be easier to add another default?
filesToDeleteAfterUpload: ['./**/*.map', './.*/**/*.map']|
Good question! Howeeever, a static glob is one decision for the whole project, while it differs per environment whether Sentry enabled the source maps. For example, the glob would be used whenever the top-level Also, the glob has no ignore list, so Reading the output directories from the resolved config also covers Nitro presets like Created a PR for Nuxt to improve this: #25450 |
…-delete-source-maps # Conflicts: # packages/tanstackstart-react/src/vite/sourceMaps.ts
|
that's a great point. Let's go with the new flow then 👍 |
JPeer264
left a comment
There was a problem hiding this comment.
Just a general question and maybe a little broad. Is there any possibility that the output dir is either not set, or a different option can be set (or set via ENV variables)? Just asking since if this one is not set, we're not deleting any sourcemaps by default, as the default glob is gone now.
Maybe we should add a console.warn (without debug) for cases where the filesToDelete is empty?
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.
The output dir is always set: Vite defaults |
The default
filesToDeleteAfterUpload: ['./**/*.map']does not enter dot directories like.output, so the client source maps that Sentry enabled stayed in the build output of Nitro apps.build.sourcemap, an environment setting orbuild.rolldownOptions.output.sourcemap../**/*.mapalso deleted source maps of dependencies innode_modules(npm and yarn layouts).build.outDir.Refs #21012