Skip to content

fix(nextjs): Skip build modification when SRI is enabled#20694

Open
chargome wants to merge 1 commit intodevelopfrom
feat/fix-sri-turbopack
Open

fix(nextjs): Skip build modification when SRI is enabled#20694
chargome wants to merge 1 commit intodevelopfrom
feat/fix-sri-turbopack

Conversation

@chargome
Copy link
Copy Markdown
Member

@chargome chargome commented May 6, 2026

With this we detect ant SRI config and, if enabled, skip the logic for stripping sourcemap comments on finished builds.

closes #20675

@chargome chargome self-assigned this May 6, 2026
@chargome chargome changed the title feat(nextjs): Skip build modification when SRI is enabled fix(nextjs): Skip build modification when SRI is enabled May 6, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

size-limit report 📦

Path Size % Change Change
@sentry/browser 26.3 kB - -
@sentry/browser - with treeshaking flags 24.78 kB - -
@sentry/browser (incl. Tracing) 44.17 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 46.39 kB - -
@sentry/browser (incl. Tracing, Profiling) 49.14 kB - -
@sentry/browser (incl. Tracing, Replay) 83.55 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 73.01 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 88.23 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 100.84 kB - -
@sentry/browser (incl. Feedback) 43.44 kB - -
@sentry/browser (incl. sendFeedback) 31.11 kB - -
@sentry/browser (incl. FeedbackAsync) 36.19 kB - -
@sentry/browser (incl. Metrics) 27.6 kB - -
@sentry/browser (incl. Logs) 27.73 kB - -
@sentry/browser (incl. Metrics & Logs) 28.43 kB - -
@sentry/react 28.04 kB - -
@sentry/react (incl. Tracing) 46.4 kB - -
@sentry/vue 31.18 kB - -
@sentry/vue (incl. Tracing) 46.02 kB - -
@sentry/svelte 26.32 kB - -
CDN Bundle 28.91 kB - -
CDN Bundle (incl. Tracing) 46.94 kB - -
CDN Bundle (incl. Logs, Metrics) 30.34 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 48.04 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 69.4 kB - -
CDN Bundle (incl. Tracing, Replay) 84.07 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 85.15 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 89.89 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 90.97 kB - -
CDN Bundle - uncompressed 84.88 kB - -
CDN Bundle (incl. Tracing) - uncompressed 140.44 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 89.08 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 143.9 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 212.99 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 258.24 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 261.69 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 271.94 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 275.38 kB - -
@sentry/nextjs (client) 48.9 kB - -
@sentry/sveltekit (client) 44.64 kB - -
@sentry/node-core 59.81 kB +0.02% +10 B 🔺
@sentry/node 163.43 kB +0.01% +8 B 🔺
@sentry/node - without tracing 72.28 kB +0.02% +8 B 🔺
@sentry/aws-serverless 106.95 kB +0.01% +7 B 🔺
@sentry/cloudflare (withSentry) - minified 168.38 kB - -
@sentry/cloudflare (withSentry) 424.9 kB - -

View base workflow run

@chargome chargome marked this pull request as ready for review May 6, 2026 08:48
@chargome chargome requested a review from a team as a code owner May 6, 2026 08:48
@chargome chargome requested a review from logaretm May 6, 2026 08:49
@masterjanic
Copy link
Copy Markdown

@chargome As far as I understand this will just skip the stripping so the not existing source map urls will still take place in production builds. Will there be any further solution? I guess the stripping would need to be done before Next.js / Turbopack generates the hashes. Otherwise we still get the sourcemap 404 warnings in the browser when SRI is enabled.

@chargome
Copy link
Copy Markdown
Member Author

chargome commented May 6, 2026

@masterjanic debug id injections and source map handling in turbopack already is baked into the build phase in next.js, not coming from sentry. While I agree this is sort of a tradeoff, the 404s for certain .map files in the dev console are harmless and will not interfere with your app in any way. We should investigate with vercel if we can avoid the sourceMappingURL comments in the first place - but this pr unblocks SRI for now

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.

Subresource Integrity (SRI) not working on Next.js with Turbopack

2 participants