Skip to content

fix(nuxt): Upload client source maps#19805

Merged
s1gr1d merged 2 commits intodevelopfrom
sig/nuxt-source-maps-client
Mar 16, 2026
Merged

fix(nuxt): Upload client source maps#19805
s1gr1d merged 2 commits intodevelopfrom
sig/nuxt-source-maps-client

Conversation

@s1gr1d
Copy link
Member

@s1gr1d s1gr1d commented Mar 13, 2026

We were pushing the Sentry plugin to the Vite plugins array dynamically inside the config() hook of a wrapper plugin (addVitePlugin from Nuxt). The Sentry plugin was not added reliably as it was nested in this wrapper plugin. This prevented the client bundle source map upload phase from triggering.

closes #19743

@s1gr1d s1gr1d requested review from JPeer264 and chargome March 13, 2026 15:36
Copy link

@cursor cursor bot left a comment

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.

],
{ dev: false, build: true }, // Only add source map plugin during build
);
}
Copy link

Choose a reason for hiding this comment

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

Vite plugin options read before modules:done hook mutates them

High Severity

getPluginOptions(moduleOptions, shouldDeleteFilesFallback) is now called synchronously at setup time (line 89), before the modules:done hook (line 43) has a chance to mutate shouldDeleteFilesFallback. Since shouldDeleteFilesFallback starts as { client: true, server: true }, filesToDeleteAfterUpload will always include the default deletion globs — even when the user explicitly enabled source maps (where it should be undefined). Previously this call was deferred inside the Vite plugin's config() hook, which ran after modules:done. The test at line 182 was updated to assert the now-broken behavior instead of catching the regression.

Additional Locations (2)
Fix in Cursor Fix in Web

@github-actions
Copy link
Contributor

github-actions bot commented Mar 13, 2026

size-limit report 📦

⚠️ Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

Path Size % Change Change
@sentry/browser 25.64 kB - -
@sentry/browser - with treeshaking flags 24.14 kB - -
@sentry/browser (incl. Tracing) 42.62 kB - -
@sentry/browser (incl. Tracing, Profiling) 47.28 kB - -
@sentry/browser (incl. Tracing, Replay) 81.42 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 71 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 86.12 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 98.37 kB - -
@sentry/browser (incl. Feedback) 42.45 kB - -
@sentry/browser (incl. sendFeedback) 30.31 kB - -
@sentry/browser (incl. FeedbackAsync) 35.36 kB - -
@sentry/browser (incl. Metrics) 26.92 kB - -
@sentry/browser (incl. Logs) 27.07 kB - -
@sentry/browser (incl. Metrics & Logs) 27.74 kB - -
@sentry/react 27.39 kB - -
@sentry/react (incl. Tracing) 44.95 kB - -
@sentry/vue 30.08 kB - -
@sentry/vue (incl. Tracing) 44.48 kB - -
@sentry/svelte 25.66 kB - -
CDN Bundle 28.27 kB - -
CDN Bundle (incl. Tracing) 43.5 kB - -
CDN Bundle (incl. Logs, Metrics) 29.13 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 44.34 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 68.2 kB - -
CDN Bundle (incl. Tracing, Replay) 80.32 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 81.22 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 85.86 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 86.76 kB - -
CDN Bundle - uncompressed 82.56 kB - -
CDN Bundle (incl. Tracing) - uncompressed 128.5 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 85.43 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 131.37 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 209.06 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 245.35 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 248.21 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 258.26 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 261.11 kB - -
@sentry/nextjs (client) 47.37 kB - -
@sentry/sveltekit (client) 43.07 kB - -
@sentry/node-core 56.34 kB +0.02% +11 B 🔺
@sentry/node 173.23 kB +0.03% +48 B 🔺
@sentry/node - without tracing 96.35 kB +0.01% +5 B 🔺
@sentry/aws-serverless 113.34 kB +0.01% +7 B 🔺

View base workflow run

Copy link
Member

@chargome chargome left a comment

Choose a reason for hiding this comment

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

Nice find!

});

it('uses mutated shouldDeleteFilesFallback (explicitly enabled → false): plugin.config() after modules:done gets no filesToDeleteAfterUpload', async () => {
it('sentryVitePlugin is called with fallback filesToDeleteAfterUpload even when source maps are explicitly enabled', async () => {
Copy link
Member

Choose a reason for hiding this comment

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

q: Double checking: we do want to delete defaultFilesToDeleteAfterUpload even if the user has explicitly enabled SM?

Copy link
Member Author

Choose a reason for hiding this comment

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

The behavior was correct (I tested it manually) - but I updated the test. This was actually not correct, we don't want to delete anything if it's explicitly set.

@s1gr1d s1gr1d enabled auto-merge (squash) March 16, 2026 08:58
@github-actions
Copy link
Contributor

node-overhead report 🧳

Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.

Scenario Requests/s % of Baseline Prev. Requests/s Change %
GET Baseline 9,022 - 9,308 -3%
GET With Sentry 1,751 19% 1,684 +4%
GET With Sentry (error only) 6,277 70% 6,154 +2%
POST Baseline 1,203 - 1,207 -0%
POST With Sentry 613 51% 601 +2%
POST With Sentry (error only) 1,074 89% 1,053 +2%
MYSQL Baseline 3,267 - 3,232 +1%
MYSQL With Sentry 501 15% 432 +16%
MYSQL With Sentry (error only) 2,628 80% 2,655 -1%

View base workflow run

@s1gr1d s1gr1d merged commit 0067c64 into develop Mar 16, 2026
230 checks passed
@s1gr1d s1gr1d deleted the sig/nuxt-source-maps-client branch March 16, 2026 09:15
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.

[Nuxt 4] Client-side sourcemaps not uploading

3 participants