Skip to content

feat(nextjs): Align build options with BuildTimeOptionsBase - #23563

Merged
chargome merged 8 commits into
developfrom
feat/nextjs-align-build-options
Aug 25, 2026
Merged

feat(nextjs): Align build options with BuildTimeOptionsBase#23563
chargome merged 8 commits into
developfrom
feat/nextjs-align-build-options

Conversation

@chargome

@chargome chargome commented Aug 25, 2026

Copy link
Copy Markdown
Member

Builds SentryBuildOptions on the shared BuildTimeOptionsBase instead of redeclaring it by hand — follow-up to #23372.

  • Six options stay local: project (allows string[], project option type should be string | string[] across all framework SDKs #21069), sourcemaps (Next-only deleteSourcemapsAfterUpload), release (inject is SDK-controlled), and buildTimeInstrumentation / applicationKey / moduleMetadata (Turbopack caveats in their docs).
  • sourcemaps.disable gains 'disable-upload' and release.setCommits / deploy gain false, both passed through to the bundler plugin — no behavior change.
  • Adds tests pinning that 'disable-upload' doesn't make the SDK auto-generate source maps it would neither upload nor delete.

Build `SentryBuildOptions` on the shared `BuildTimeOptionsBase` instead of redeclaring the
option set by hand. Next.js was the last meta-framework SDK not using the shared type, which
is why #23372 had to manually add `moduleMetadata` and `sourcemaps.resolveSourceMap`.

Six options stay declared locally, each for a Next.js-specific reason: `project` accepts
`string[]`, `sourcemaps` adds `deleteSourcemapsAfterUpload`, `release` omits `inject` because
the SDK always sets it, and `buildTimeInstrumentation` / `applicationKey` / `moduleMetadata`
document webpack-vs-Turbopack behavior differences.

Inheriting the base type widens `sourcemaps.disable` to accept `'disable-upload'`. Next.js
checked the option for truthiness where it controls source map generation, which would have
suppressed generation entirely rather than just the upload, so those checks now compare
against `true` and the auto-delete defaults skip `'disable-upload'`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@chargome chargome self-assigned this Aug 25, 2026
@github-actions

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 28.57 kB - -
@sentry/browser - with treeshaking flags 26.92 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 26.82 kB - -
@sentry/browser (incl. Tracing) 48.5 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 48.52 kB - -
@sentry/browser (incl. Tracing, Profiling) 51.43 kB - -
@sentry/browser (incl. Tracing, Replay) 87.89 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 77.35 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 92.59 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 105.3 kB - -
@sentry/browser (incl. Feedback) 45.81 kB - -
@sentry/browser (incl. sendFeedback) 33.36 kB - -
@sentry/browser (incl. FeedbackAsync) 38.47 kB - -
@sentry/browser (incl. Metrics) 29.52 kB - -
@sentry/browser (incl. Logs) 29.8 kB - -
@sentry/browser (incl. Metrics & Logs) 30.45 kB - -
@sentry/react 30.33 kB - -
@sentry/react (incl. Tracing) 50.71 kB - -
@sentry/vue 35.64 kB - -
@sentry/vue (incl. Tracing) 50.73 kB - -
@sentry/svelte 28.6 kB - -
CDN Bundle 30.32 kB - -
CDN Bundle (incl. Tracing) 49.02 kB - -
CDN Bundle (incl. Logs, Metrics) 32.54 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 50.89 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 72.91 kB - -
CDN Bundle (incl. Tracing, Replay) 86.47 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 88.33 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 92.22 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 94.17 kB - -
CDN Bundle - uncompressed 89.94 kB - -
CDN Bundle (incl. Tracing) - uncompressed 146.64 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 96.23 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 152.33 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 225.18 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 265.92 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 271.6 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 279.62 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 285.28 kB - -
@sentry/nextjs (client) 53.23 kB - -
@sentry/sveltekit (client) 48.92 kB - -
@sentry/core/server 65.11 kB - -
@sentry/core/browser 52.27 kB - -
@sentry/node 121.77 kB +0.02% +19 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 85.18 kB - -
@sentry/node - without tracing 87.58 kB +0.03% +23 B 🔺
@sentry/aws-serverless 95.99 kB +0.03% +24 B 🔺
@sentry/cloudflare (withSentry) - minified 196.9 kB - -
@sentry/cloudflare (withSentry) 487.47 kB - -

View base workflow run

@chargome

Copy link
Copy Markdown
Member Author

bugbot run

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

✅ 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 9e5d200. Configure here.

chargome and others added 6 commits August 25, 2026 11:18
`debug` is respected by the SDK's own build-time code in several places; only `silent` is
still plugin-only.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…y/sentry-javascript into feat/nextjs-align-build-options
…pload'`

Treating `'disable-upload'` as "upload off, everything else on" made the SDK enable source map
generation and then skip deletion, leaving `.next/static/**/*.map` served publicly.

`'disable-upload'` means the SDK stays out of the source map pipeline entirely and only the
bundler plugin's debug ID injection runs, matching `sentryTanstackStart.ts`. Generation is the
user's call via `productionBrowserSourceMaps` / `devtool`, and the SDK only auto-deletes what it
auto-generated.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The base type's doc doesn't mention that this option overrides `deleteSourcemapsAfterUpload`,
which is Next.js-only. Override it like `ignore` so the precedence stays documented.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The type test needs vitest typecheck enabled, and this package's `tsconfig.test.json` has never
been run - it currently has ~80 errors in unrelated test files. Cleaning those up and adding the
type test belongs in its own PR rather than riding along with a type refactor.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@chargome
chargome marked this pull request as ready for review August 25, 2026 12:46
@chargome
chargome requested a review from a team as a code owner August 25, 2026 12:46
@chargome
chargome requested review from logaretm, mydea, nicohrubec and s1gr1d and removed request for a team and mydea August 25, 2026 12:46
@chargome
chargome merged commit 1718e70 into develop Aug 25, 2026
272 checks passed
@chargome
chargome deleted the feat/nextjs-align-build-options branch August 25, 2026 13:19
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.

2 participants