Repository navigation
Description
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/nextjs
SDK Version
11.23.0 (also 11.17.0; 11.16.0 works)
Framework Version
Next.js 16.4.6, next build --turbopack, Node 24
Link to Sentry event
No response
Reproduction Example/SDK Setup
Minimal app: an App Router page, plus these two files.
instrumentation-client.ts:
import * as Sentry from "@sentry/nextjs";
Sentry.init({ dsn: "https://public@o0.ingest.sentry.io/0" });next.config.ts:
import { withSentryConfig } from "@sentry/nextjs/config";
export default withSentryConfig({}, {
telemetry: false,
silent: true,
sourcemaps: { disable: true },
bundleSizeOptimizations: { excludeTracing: true },
});Steps to Reproduce
- Build the app above with
next build --turbopack. - Search
.next/static/chunks/*.jsfor the body ofbrowserTracingIntegration(e.g.instrumentBfcacheRestore) and for"SpanStreaming". - Repeat with
@sentry/nextjs11.16.0.
Expected Result
No tracing code in the client bundle, as in 11.16.0.
Actual Result
@sentry/nextjs |
browserTracingIntegration body |
SpanStreaming |
client JS (gzip) |
|---|---|---|---|
| 11.16.0 | absent | absent | 210 KB |
| 11.17.0 | present | present | 228 KB |
| 11.23.0 | present | present | 228 KB |
In a larger app we also see SpanStreaming in the edge (middleware) bundle.
Additional Context
#26779 changed defineIntegration from return fn to returning a new closure that records the options. Before, the minifier could inline the call and drop an unused const fooIntegration = defineIntegration(...). Now the call looks side-effectful, so every integration defined at module level stays in the bundle, with all the code it references. The __SENTRY_TRACING__ guard in getDefaultIntegrations still becomes false, so the integration is never used, but its definition is no longer removed.
We confirmed this by patching defineIntegration in @sentry/core 11.23.0 back to return fn: the tracing code leaves the browser and edge bundles again. Adding /* @__PURE__ */ to the single browserTracingIntegration = defineIntegration(...) call did not help in our app, so the fix probably has to be in defineIntegration itself, or in how it is called everywhere.
Possibly related: #26902 (web-vitals with excludeTracing in Astro, fixed by the rolldown bump in 11.23.0). This one is still present in 11.23.0 with Turbopack.
Priority
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it.
Metadata
Metadata
Assignees
Projects
- StatusShow more project fieldsWaiting for: Product Owner
Activity
linear-code commentedon Dec 4, 2026
JS-4235