Skip to content

build(browser): Inline all constants in CDN bundles - #26356

Closed
msonnb wants to merge 1 commit into
developfrom
ms/cdn-inline-const
Closed

msonnb wants to merge 1 commit into
developfrom
ms/cdn-inline-const

Conversation

@msonnb

@msonnb msonnb commented Nov 13, 2026

Copy link
Copy Markdown
Member

Why: Rolldown's default inlineConst: { mode: 'smart' } inlines constants only inside conditions. Frequently used strings, mostly from @sentry/conventions, therefore end up both as a variable and as literal copies: sentry.op is one variable plus about 10 literals in bundle.tracing.min.js. With mode: 'all' every use becomes a literal. Raw size grows, but gzip handles repeated literals better than variable references, so what users download gets smaller:

raw gzip
all 54 browser .min.js bundles +24.5 KB −2.4 KB
bundle.min.js +125 B −41 B
bundle.tracing.min.js +1.4 KB −132 B
bundle.tracing.replay.min.js +1.4 KB −145 B
bundle.tracing.logs.metrics.min.js +1.6 KB −172 B

inlineConst: false went the other way: −3.9 KB raw, +261 B gzip. pass: 2 made no difference. This only touches the CDN bundle config, not npm builds.

How to review: Single config line. I ran the browser integration tests against bundle_tracing_replay_min: 641 passed, and 1 failed. That one (web-vitals-cls-without-array-at) also fails on develop locally.

🤖 Generated with Claude Code

Rolldown's default `inlineConst: 'smart'` only inlines constants in
conditions, so frequently used `@sentry/conventions` strings end up both as a
variable and as literal copies. Inlining everywhere grows the raw output but
shrinks the gzipped CDN bundles by ~90-170 B each.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

Compared: 583af81 (PR test merge using develop at 88cc648)

Against: 88cc648 (develop) · base run #66002

✅ 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.89 kB +0.06% +18 B 🔺
CDN Bundle (incl. Tracing) 52.56 kB -0.27% -140 B 🔽
CDN Bundle (incl. Logs, Metrics) 34.64 kB -0.09% -29 B 🔽
CDN Bundle (incl. Tracing, Logs, Metrics) 55.11 kB -0.28% -154 B 🔽
CDN Bundle (incl. Replay, Logs, Metrics) 75.67 kB -0.05% -32 B 🔽
CDN Bundle (incl. Tracing, Replay) 90.56 kB -0.18% -160 B 🔽
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 93.14 kB -0.2% -183 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback) 96.09 kB +0.01% +6 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 98.62 kB -0.07% -65 B 🔽
CDN Bundle - uncompressed 93.11 kB +0.14% +121 B 🔺
CDN Bundle (incl. Tracing) - uncompressed 156.82 kB +0.89% +1.37 kB 🔺
CDN Bundle (incl. Logs, Metrics) - uncompressed 101.53 kB +0.21% +209 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 164.64 kB +0.96% +1.55 kB 🔺
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 231.65 kB +0.1% +215 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 276.98 kB +0.51% +1.38 kB 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 284.79 kB +0.56% +1.56 kB 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 289.08 kB +0.59% +1.69 kB 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 296.89 kB +0.64% +1.87 kB 🔺
@sentry/nextjs (client) 58.34 kB - -
@sentry/sveltekit (client) 53.36 kB - -
@sentry/core/server 44.57 kB - -
@sentry/core/browser 13.99 kB - -
@sentry/node 149.6 kB +0.04% +50 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 83.3 kB - -
@sentry/node - without tracing 88.53 kB +0.06% +48 B 🔺
@sentry/node - without channel injection 138.54 kB +0.04% +45 B 🔺
@sentry/aws-serverless 97.44 kB +0.05% +47 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

@msonnb msonnb closed this Nov 13, 2026
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