Skip to content

feat(tanstackstart-react): Delete source maps through the bundler plugin instead of globs - #26336

Open
timfish wants to merge 1 commit into
developfrom
feat/tanstackstart-delete-sourcemaps-after-upload
Open

timfish wants to merge 1 commit into
developfrom
feat/tanstackstart-delete-sourcemaps-after-upload

Conversation

@timfish

@timfish timfish commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

TanStack Start built its own filesToDeleteAfterUpload globs from the resolved output directories, which needed a Vite 8 check and a list of Nitro service directories to stay out of. The SDK now passes the internal deleteSourcemapsAfterUpload and sdkEnabledSourceMaps function options, which receive the Vite environment name. It returns true for the top-level decision when it set build.sourcemap: 'hidden', and for the nitro environment when it set Nitro's sourcemap itself. The bundler plugin then removes those maps. As before, it also removes them when no upload runs, for example without an auth token.

The ssr Nitro service keeps its maps. applyToEnvironment keeps the Sentry plugins out of Nitro service environments, and the SDK's makeComposeNitroServiceSourceMapsPlugin reads those maps in its load hook when Nitro bundles the service output again.

Maps the user turned on with build.sourcemap, an environment's build.sourcemap, top-level build.rolldownOptions.output.sourcemap or Nitro's options are kept, as before. A user's filesToDeleteAfterUpload is passed through and runs together with the SDK's deletion, as before.

Two behaviour changes. First, when the SDK turned on source maps, an environment output that sets its own sourcemap (for example environments.client.build.rolldownOptions.output.sourcemap) now has its maps removed too, visible ones included, like the other SDKs. Develop kept them. Second, on Vite 7 the old globs only covered build.outDir, so the SDK-enabled nitro maps in .output/server stayed (the SDK warned about this). The bundler plugin now removes them too.

The tanstackstart-react-sourcemaps E2E app gets a no-upload variant that asserts no maps and no sourceMappingURL comments in .output. Both TanStack Start E2E apps now record chunks without a map in generateBundle, because the plugin removes maps before writeBundle. This depends on #26281.

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

size-limit report 📦

Compared: 7107c9f (PR test merge using develop at 9279303)

Against: 9279303 (develop) · base run #66015

✅ Baseline matches: this diff contains only this PR's changes.

Path Size % Change Change
@sentry/browser 30.1 kB - -
@sentry/browser - with treeshaking flags 28.3 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 28.2 kB - -
@sentry/browser (incl. Tracing) 52.28 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 52.29 kB - -
@sentry/browser (incl. Tracing, Profiling) 55.25 kB - -
@sentry/browser (incl. Tracing, Replay) 92.82 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 81.6 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 97.21 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 110.6 kB - -
@sentry/browser (incl. Feedback) 47.73 kB - -
@sentry/browser (incl. sendFeedback) 30.69 kB - -
@sentry/browser (incl. FeedbackAsync) 35.69 kB - -
@sentry/browser (incl. Metrics) 31.43 kB - -
@sentry/browser (incl. Logs) 31.71 kB - -
@sentry/browser (incl. Metrics & Logs) 32.37 kB - -
@sentry/react 32.11 kB - -
@sentry/react (incl. Tracing) 54.95 kB - -
@sentry/vue 38.3 kB - -
@sentry/vue (incl. Tracing) 55.24 kB - -
@sentry/svelte 30.12 kB - -
@sentry/remix (Remix 3 client bundle) 58.06 kB - -
CDN Bundle 31.87 kB - -
CDN Bundle (incl. Tracing) 52.7 kB - -
CDN Bundle (incl. Logs, Metrics) 34.67 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 55.26 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 75.7 kB - -
CDN Bundle (incl. Tracing, Replay) 90.72 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 93.33 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 96.09 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 98.69 kB - -
CDN Bundle - uncompressed 92.98 kB - -
CDN Bundle (incl. Tracing) - uncompressed 155.45 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 101.33 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 163.08 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 231.43 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 275.6 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 283.23 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 287.39 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 295.01 kB - -
@sentry/nextjs (client) 58.34 kB - -
@sentry/sveltekit (client) 53.46 kB - -
@sentry/core/server 44.57 kB - -
@sentry/core/browser 13.99 kB - -
@sentry/node 149.54 kB -0.01% -4 B 🔽
@sentry/node/import (ESM hook with diagnostics-channel injection) 83.3 kB - -
@sentry/node - without tracing 88.47 kB -0.01% -8 B 🔽
@sentry/node - without channel injection 138.5 kB -0.01% -3 B 🔽
@sentry/aws-serverless 97.39 kB -0.01% -8 B 🔽
@sentry/cloudflare (withSentry) - minified 204.55 kB - -
@sentry/cloudflare (withSentry) 474.76 kB - -
@sentry/nextjs/cloudflare (withSentry) - minified 229.86 kB - -

View base workflow run

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Optional E2E tests

All optional checks were successful. 4 successful. See the run.

Successful checks
Check Status
✅ CI: Optional E2E Tests / E2E tanstackstart-react (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-sourcemaps (no upload) Test (optional) Successful in 27s Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-cloudflare Test (optional) Successful in 31s Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-sourcemaps Test (optional) Successful in 34s Details

@timfish
timfish force-pushed the feat/tanstackstart-delete-sourcemaps-after-upload branch from f7fe7e8 to 0c37b6f Compare November 13, 2026 11:35
Base automatically changed from feat/bundler-plugins-delete-without-upload to develop November 13, 2026 13:49
…gin instead of globs

The SDK turns on hidden source maps for the client build and for Nitro's server build. It now asks the bundler plugin to remove them through `deleteSourcemapsAfterUpload` and `sdkEnabledSourceMaps`, which receive the Vite environment, instead of building `filesToDeleteAfterUpload` globs from the resolved output directories. As before, the maps are also removed when no upload runs. The maps of the Nitro `ssr` service stay, because the SDK's own Nitro plugin reads them after the build.

A user's `filesToDeleteAfterUpload` is passed through and runs as well. Maps the user turned on with `build.sourcemap` or Nitro's options are kept. Maps of an output with its own `sourcemap` are removed when the SDK turned on source maps for its environment.
@timfish
timfish force-pushed the feat/tanstackstart-delete-sourcemaps-after-upload branch from 0c37b6f to 560f372 Compare November 13, 2026 13:53
@timfish
timfish marked this pull request as ready for review November 13, 2026 17:36
@timfish
timfish requested a review from a team November 13, 2026 17:36

@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.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 560f372. Configure here.

filesToDeleteAfterUpload: sourcemaps?.filesToDeleteAfterUpload,
// Called when the bundler plugin decides, after the SDK's enable plugins ran.
deleteSourcemapsAfterUpload: environment =>
sourcemaps?.deleteSourcemapsAfterUpload ?? (hasSdkEnabledSourceMaps(state, environment) || undefined),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

User globs no longer replace SDK deletion

Medium Severity

Setting sourcemaps.filesToDeleteAfterUpload used to replace the SDK's automatic map deletion. It is now passed through while deleteSourcemapsAfterUpload still strips SDK-enabled maps, so a custom or empty glob no longer keeps those files. Apps that relied on that option to preserve server maps or skip cleanup will lose them, and there is no migration note for the new deleteSourcemapsAfterUpload: false escape hatch.

Fix in Cursor Fix in Web

Triggered by project rule: PR Review Guidelines for Cursor Bot

Reviewed by Cursor Bugbot for commit 560f372. Configure here.

"build-command": "pnpm test:build:no-upload",
"assert-command": "pnpm test:assert:no-upload",
"label": "tanstackstart-react-sourcemaps (no upload)"
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing keep-maps E2E variant

Low Severity

The sourcemaps E2E app adds a no-upload variant that expects maps to be gone, but it has no deleteSourcemapsAfterUpload: false run that expects .map files and sourceMappingURL comments to remain in .output/public. A regression that always strips maps would not fail these tests.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 560f372. Configure here.

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.

1 participant