Skip to content

feat(nuxt): Delete client source maps through the bundler plugin instead of a glob - #26338

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

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

Conversation

@timfish

@timfish timfish commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

When the Nuxt SDK turns on hidden client source maps with the Vite builder and the user set neither deleteSourcemapsAfterUpload nor filesToDeleteAfterUpload, it now passes deleteSourcemapsAfterUpload: true and sdkEnabledSourceMaps to the client Vite plugin instead of deleting the maps later with a glob. Both apply to the client build only: with the Vite environment API (Nuxt 5, or Nuxt 4 with experimental.viteEnvironmentApi) the ssr and nitro environments get neither, so the plugin does not change their settings. The plugin never writes those maps to the build output. As before, this also holds when no upload runs and for chunks that the user's assets or ignore leave out. The old glob deleted every *.map in the Nitro public dir, including maps from the user's public/ folder or other modules; the new code removes only the maps of the Vite client bundle. With the webpack or rspack builder no Vite plugin runs, so the SDK keeps the public-dir glob there. With server.builder: 'vite' (no Nitro) the SDK-enabled client maps are now removed, where the old glob never ran because it waited for Nitro. A user's filesToDeleteAfterUpload still replaces the SDK's client deletion and runs in the Nitro build before Nitro lists its public files, so deleted maps return 404. The server side is unchanged because Nitro needs the SSR maps on disk.

The Nuxt 4 and 5 source map apps get a no-upload variant that asserts no client maps and no sourceMappingURL comments in the public output, and the Nuxt 5 app gets a variant where Sentry turns the client maps on and uploads them. The Nuxt 4 app now records chunks without a map during the build, because maps the SDK turned on no longer reach .nuxt/dist/client. The nuxt-5-sourcemaps app is optional in CI, so its variants were run locally.

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Optional E2E tests

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

Successful checks
Check Status
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (client source maps kept) Test (optional) Successful in 41s Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (tunnel-dev) Test (optional) Successful in 52s Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (client source maps enabled by Sentry) Test (optional) Successful in 37s Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (kv-cache) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (no upload) Test (optional) Successful in 32s Details
✅ CI: Optional E2E Tests / E2E nuxt-5 Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps Test (optional) Successful in 35s Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (static / nuxt generate) Test (optional) Successful in 32s Details
✅ CI: Optional E2E Tests / E2E nuxt-5-cloudflare Test (optional) Successful in 34s Details

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

size-limit report 📦

Compared: bf8f4d3 (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% -4 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

@timfish
timfish force-pushed the feat/nuxt-delete-sourcemaps-after-upload branch from 1bd66b9 to 48ccf3b Compare November 13, 2026 11:35
Base automatically changed from feat/bundler-plugins-delete-without-upload to develop November 13, 2026 13:49
…ead of a glob

When the SDK enables hidden client source maps with the Vite builder and the user set neither `deleteSourcemapsAfterUpload` nor `filesToDeleteAfterUpload`, the client Vite plugin now gets `deleteSourcemapsAfterUpload: true` and `sdkEnabledSourceMaps` for the client build only. With the Vite environment API, the `ssr` and `nitro` environments get neither. The maps then never reach the build output. As before, this also holds when no upload runs and for chunks outside a user's `assets` or `ignore`. This replaces the client fallback glob, which deleted every map in the Nitro public dir. With the webpack or rspack builder no Vite plugin runs, so the public-dir glob stays. A user's `filesToDeleteAfterUpload` still replaces the SDK's deletion and runs in the Nitro build. The server side is unchanged.
@timfish
timfish force-pushed the feat/nuxt-delete-sourcemaps-after-upload branch from 48ccf3b to e249657 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 1 potential issue.

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 e249657. Configure here.

*/
function isClientEnvironment(environment: string | undefined): boolean {
return environment === undefined || environment === 'client';
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

SSR maps can inherit client deletion

Medium Severity

isClientEnvironment treats a missing environment name as the client build, so the SDK default turns on deleteSourcemapsAfterUpload and sdkEnabledSourceMaps for that case. The Vite plugin always makes its shared * decision with no environment name, then uses that decision for every environment that did not have its own build.sourcemap in the config hook. Under the Vite environment API, ssr or nitro can therefore inherit client deletion and lose the SSR maps Nitro still needs. Previously deleteSourcemapsAfterUpload was always false, so that fallback did not remove maps.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit e249657. 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