Title: feat(bundle): Reduce browser CDN bundle size by ~2.3% (-644 bytes gzipped) · Issue #19834 · getsentry/sentry-javascript · GitHub
Open Graph Title: feat(bundle): Reduce browser CDN bundle size by ~2.3% (-644 bytes gzipped) · Issue #19834 · getsentry/sentry-javascript
X Title: feat(bundle): Reduce browser CDN bundle size by ~2.3% (-644 bytes gzipped) · Issue #19834 · getsentry/sentry-javascript
Description: NoteThe pull request "feat(bundle): Reduce browser CDN bundle size by ~2.3% (-644 bytes gzipped)" was created by @HazAT but did not reference an issue. Therefore this issue was created for better visibility in external tools like Linear....
Open Graph Description: NoteThe pull request "feat(bundle): Reduce browser CDN bundle size by ~2.3% (-644 bytes gzipped)" was created by @HazAT but did not reference an issue. Therefore this issue was created for better v...
X Description: NoteThe pull request "feat(bundle): Reduce browser CDN bundle size by ~2.3% (-644 bytes gzipped)" was created by @HazAT but did not reference an issue. Therefore this issue was created fo...
Mail addresses
claude@anthropic.com
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/19834
X: @github
Domain: github.com
IPv4 address: 140.82.113.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"feat(bundle): Reduce browser CDN bundle size by ~2.3% (-644 bytes gzipped)","articleBody":"> [!NOTE]\n> The pull request \"[feat(bundle): Reduce browser CDN bundle size by ~2.3% (-644 bytes gzipped)](https://github.com/getsentry/sentry-javascript/pull/19833)\" was created by @HazAT but did not reference an issue. Therefore this issue was created for better visibility in external tools like Linear.\n\n## Summary\n\nReduces the base browser CDN bundle (`bundle.min.js`) gzipped size by **~2.3%** (27.85 kB → 27.22 kB, saving **644 bytes** gzipped / **3.4 KB** raw).\n\nThese are safe, behavior-preserving changes found through systematic experimentation across 50 iterations. No public API changes, no removed functionality.\n\n## Changes by category\n\n### Terser minifier configuration (`dev-packages/rollup-utils`)\n\nThe existing terser config used defaults for compression. Enabling additional safe options yields ~300 bytes gzipped:\n\n- **`compress.passes: 5`** — multi-pass optimization finds more dead code\n- **`compress.ecma: 2020`** — allows modern syntax in output (nullish coalescing, optional chaining)\n- **`compress.toplevel: true`** — better variable inlining within the IIFE\n- **`compress.unsafe_arrows: true`** — converts `function` to `=>` where `this` is unused (~1.3 KB raw)\n- **`compress.unsafe_methods: true`** — converts `{ m: function(){} }` to `{ m(){} }`\n- **`compress.unsafe_comps / unsafe_math / pure_getters`** — safe algebraic optimizations\n- **`mangle.toplevel: true`** — mangle top-level variable names within the IIFE scope\n\n### Remove redundant iframe-based native fetch check (`packages/core/src/utils/supports.ts`)\n\n`supportsNativeFetch()` created a sandboxed iframe to check if `fetch` is natively implemented — identical logic to `getNativeImplementation(\"fetch\")` in `browser-utils`. The function is only called behind a `skipNativeFetchCheck` guard that is never `true` in the base CDN bundle, making the iframe code dead weight. Simplified to delegate to `_isFetchSupported()`. **Saves ~200 bytes gzipped.**\n\n### Slim envelope type-to-category map (`packages/core/src/utils/envelope.ts`)\n\nThe `ITEM_TYPE_TO_DATA_CATEGORY_MAP` had 18 entries, 7 of which mapped a type to itself (e.g. `session: \"session\"`). Replaced with an 11-entry overrides map that falls back to the type name itself. **Saves ~38 bytes gzipped.**\n\n### Shorten default ignore-error patterns (`packages/core/src/integrations/eventFilters.ts`)\n\nConverted verbose string literals in `DEFAULT_IGNORE_ERRORS` to shorter regex patterns with the same matching behavior:\n- `\"vv().getRestrictions is not a function. (In 'vv()...\"` → `/vv\\(\\)\\.getRestrictions is not a function/`\n- `\"Can't find variable: _AutofillCallbackHandler\"` → regex equivalent\n- Long CEFSharp `simulateEvent` pattern → shorter partial match\n\n**Saves ~38 bytes gzipped.**\n\n### Derive lazy-load integration bundle names (`packages/browser/src/utils/lazyLoadIntegration.ts`)\n\nThe `LazyLoadableIntegrations` object stored 21 key-value pairs where values were mostly derivable from keys (strip `\"Integration\"`, lowercase). Replaced with an array of names + a derivation function, with a 3-entry exceptions map for hyphenated bundle names. Also uses `string.split(\",\")` for the array. **Saves ~30 bytes gzipped.**\n\n### Consolidate `sendSession` logic (`packages/core/src/client.ts`)\n\n`sendSession()` had duplicate code blocks for session aggregates vs individual sessions, both checking and backfilling `release` and `environment`. Unified into a single code path. **Saves ~16 bytes gzipped.**\n\n### Use `URLSearchParams` in `getReportDialogEndpoint` (`packages/core/src/api.ts`)\n\nReplaced manual `encodeURIComponent` string concatenation with `URLSearchParams`, which is more concise and already used elsewhere in the same file. **Saves ~26 bytes gzipped.**\n\n### Inline Vue ViewModel checks (`packages/core/src/utils/normalize.ts`, `string.ts`)\n\n`isVueViewModel()` and `getVueInternalName()` were standalone exported functions only called from two sites (normalize and safeJoin). Inlined the checks directly, allowing tree-shaking to eliminate the standalone functions. **Saves ~15 bytes gzipped.**\n\n### Rename internal `sentryWrapped` → `sW` (`packages/browser/src/helpers.ts`, `packages/core/src/utils/stacktrace.ts`)\n\nThe `sentryWrapped` function name in the `wrap()` helper is reserved from mangling because it is matched by a regex in `stripSentryFramesAndReverse()` for internal frame stripping. Shortened to `sW` and updated the regex to match both names for backwards compatibility. **Saves ~10 bytes gzipped.**\n\n### Smaller cleanups\n\n- **`DEFAULT_EVENT_TARGET`** array → comma-separated `string.split(\",\")` (51 bytes raw)\n- **`getErrorPropertyFromObject`** — `Object.values().find()` instead of `for...in` loop\n- **`getOwnProperties`** — `Object.fromEntries(Object.entries())` instead of manual loop\n- **`isNativeFunction`** — simplified regex from exact whitespace match to `/\\[native code\\]/`\n- **Browser extension detection** — regex test instead of `array.some()` with `startsWith`\n- **`_enhanceEventWithInitialFrame`** — removed redundant intermediate variable aliases\n- **`baggage.ts`** — `.startsWith()` instead of `.match()` for prefix check\n- **Unused `breadcrumbData`** variable removed from fetch breadcrumb handler\n\n## What was NOT changed\n\n- No public API signatures were modified\n- No functionality was removed\n- No new dependencies were added\n- All changes are in source code or build config — no test modifications\n- The `unsafe_*` terser options only apply to CDN `.min.js` bundles (not npm ESM/CJS output)\n\nCo-Authored-By: Claude claude@anthropic.com\n","author":{"url":"https://github.com/apps/github-actions","@type":"Person","name":"github-actions"},"datePublished":"2026-03-17T11:36:49Z","url":"https://github.com/getsentry/sentry-javascript/issues/19834"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:81c4e691-ae3c-8a22-8173-8e134d9f79ee |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BB5A:205334:473247:647E63:6B047071 |
| html-safe-nonce | b7239cf3f8bde8461c905dc0ddac46b940954aa779fe72f70d0941d18026d7ca |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQjVBOjIwNTMzNDo0NzMyNDc6NjQ3RTYzOjZCMDQ3MDcxIiwidmlzaXRvcl9pZCI6IjYzNjExMTY2OTM4MjM3NzU4NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | db2bff2ea1f7a8e600ab99440e53126b0a40cca1838d7078c3fbbe9d0f780998 |
| hovercard-subject-tag | issue:4087984043 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-javascript/19834/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b3f537bdef40eb57bf9a17e20746400ec32d117be66e8776240ff2fb5463d053/getsentry/sentry-javascript/issues/19834 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b3f537bdef40eb57bf9a17e20746400ec32d117be66e8776240ff2fb5463d053/getsentry/sentry-javascript/issues/19834 |
| og:image:alt | NoteThe pull request "feat(bundle): Reduce browser CDN bundle size by ~2.3% (-644 bytes gzipped)" was created by @HazAT but did not reference an issue. Therefore this issue was created for better v... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | github-actions[bot] |
| hostname | github.com |
| expected-hostname | github.com |
| None | ae8802492f12d3ba4f6b0d814054e617a2a5616b6327bf8555c10cd5b0dc2a6f |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3328572 |
| octolytics-dimension-repository_nwo | getsentry/sentry-javascript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3328572 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-javascript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | cfb5f24c6e01d85f70804652a5107e5cac03a161 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width