Skip to content

feat(core): split exports by browser/server for bundle size#20435

Open
isaacs wants to merge 1 commit intodevelopfrom
isaacschlueter/split-server-browser-core-exports
Open

feat(core): split exports by browser/server for bundle size#20435
isaacs wants to merge 1 commit intodevelopfrom
isaacschlueter/split-server-browser-core-exports

Conversation

@isaacs
Copy link
Copy Markdown
Member

@isaacs isaacs commented Apr 21, 2026

Split the exports from @sentry/core into three options:

  • @sentry/core, the default (unchanged)
  • @sentry/core/browser, containing only shared and browser-specific
    functionality, nothing server-specific.
  • @sentry/core/server, containing only shared and server-specific
    functionality, nothing browser-specific.

This allows us to make the bundle sizes quite a bit smaller in our
browser SDKs where this is important, while adding more functionality to
our server-specific SDKs, in @sentry/core where they can be easily
shared across runtimes.

fix: #20434
fix: JS-2243

@linear-code
Copy link
Copy Markdown

linear-code Bot commented Apr 21, 2026

@isaacs isaacs force-pushed the isaacschlueter/split-server-browser-core-exports branch 6 times, most recently from 143a2a5 to 1494709 Compare April 22, 2026 01:45
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 22, 2026

size-limit report 📦

Path Size % Change Change
@sentry/browser 26.16 kB - -
@sentry/browser - with treeshaking flags 24.63 kB - -
@sentry/browser (incl. Tracing) 44.13 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 46.34 kB - -
@sentry/browser (incl. Tracing, Profiling) 49.08 kB - -
@sentry/browser (incl. Tracing, Replay) 83.48 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 72.96 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 88.15 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 100.8 kB - -
@sentry/browser (incl. Feedback) 43.4 kB - -
@sentry/browser (incl. sendFeedback) 30.96 kB - -
@sentry/browser (incl. FeedbackAsync) 36.14 kB - -
@sentry/browser (incl. Metrics) 27.44 kB - -
@sentry/browser (incl. Logs) 27.59 kB - -
@sentry/browser (incl. Metrics & Logs) 28.28 kB - -
@sentry/react 27.9 kB - -
@sentry/react (incl. Tracing) 46.36 kB - -
@sentry/vue 31.03 kB - -
@sentry/vue (incl. Tracing) 45.96 kB - -
@sentry/svelte 26.18 kB - -
CDN Bundle 28.85 kB +0.03% +7 B 🔺
CDN Bundle (incl. Tracing) 46.91 kB -0.01% -1 B 🔽
CDN Bundle (incl. Logs, Metrics) 30.27 kB -0.02% -6 B 🔽
CDN Bundle (incl. Tracing, Logs, Metrics) 48.03 kB +0.01% +4 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) 69.35 kB -0.01% -3 B 🔽
CDN Bundle (incl. Tracing, Replay) 84.07 kB +0.01% +1 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 85.14 kB -0.01% -1 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback) 89.86 kB +0.01% +1 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 90.96 kB -0.01% -2 B 🔽
CDN Bundle - uncompressed 84.55 kB - -
CDN Bundle (incl. Tracing) - uncompressed 140.16 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 88.75 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 143.62 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 212.71 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 257.96 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 261.41 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 271.66 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 275.1 kB - -
@sentry/nextjs (client) 48.85 kB - -
@sentry/sveltekit (client) 44.58 kB - -
@sentry/node-core 59.06 kB +0.02% +10 B 🔺
@sentry/node 170.35 kB +0.01% +13 B 🔺
@sentry/node - without tracing 96.92 kB +0.02% +10 B 🔺
@sentry/aws-serverless 113.78 kB +0.03% +30 B 🔺
@sentry/cloudflare (withSentry) - minified 164.96 kB - -
@sentry/cloudflare (withSentry) 417.1 kB - -

View base workflow run

@isaacs isaacs force-pushed the isaacschlueter/split-server-browser-core-exports branch 5 times, most recently from d5dddbf to 8eba1e9 Compare April 22, 2026 18:26
@isaacs isaacs marked this pull request as ready for review April 22, 2026 18:26
Comment thread dev-packages/rollup-utils/utils.mjs Outdated
@isaacs isaacs force-pushed the isaacschlueter/split-server-browser-core-exports branch from 8eba1e9 to 8ea4f5c Compare April 22, 2026 18:50
Comment thread dev-packages/rollup-utils/npmHelpers.mjs
@isaacs isaacs force-pushed the isaacschlueter/split-server-browser-core-exports branch from 8ea4f5c to 787f44b Compare April 22, 2026 19:19
@isaacs isaacs enabled auto-merge (rebase) April 22, 2026 19:19
@isaacs isaacs disabled auto-merge April 22, 2026 19:19
isaacs added a commit that referenced this pull request Apr 22, 2026
Split the exports from `@sentry/core` into three options:

- `@sentry/core`, the default (unchanged)
- `@sentry/core/browser`, containing _only_ shared and browser-specific
  functionality, nothing server-specific.
- `@sentry/core/server`, containing _only_ shared and server-specific
  functionality, nothing browser-specific.

This should allow us to make the bundle sizes quite a bit smaller in our
browser SDKs where this is important, while adding more functionality to
our server-specific SDKs, in `@sentry/core` where they can be easily
shared across runtimes.

Integration may require updating our `tsconfig` settings so that tsc
knows it is allowed to look on `package.json` exports.

fix: #20434
fix: JS-2243
@isaacs isaacs force-pushed the isaacschlueter/split-server-browser-core-exports branch from 787f44b to 7076f7c Compare April 22, 2026 19:20
Comment thread packages/core/src/shared-exports.ts
Comment thread packages/core/src/integrations/http/client-subscriptions.ts Outdated
@isaacs isaacs requested review from mydea and timfish April 23, 2026 14:24
isaacs added a commit that referenced this pull request Apr 23, 2026
Split the exports from `@sentry/core` into three options:

- `@sentry/core`, the default (unchanged)
- `@sentry/core/browser`, containing _only_ shared and browser-specific
  functionality, nothing server-specific.
- `@sentry/core/server`, containing _only_ shared and server-specific
  functionality, nothing browser-specific.

This should allow us to make the bundle sizes quite a bit smaller in our
browser SDKs where this is important, while adding more functionality to
our server-specific SDKs, in `@sentry/core` where they can be easily
shared across runtimes.

Integration may require updating our `tsconfig` settings so that tsc
knows it is allowed to look on `package.json` exports.

fix: #20434
fix: JS-2243
@isaacs isaacs force-pushed the isaacschlueter/split-server-browser-core-exports branch from 7076f7c to e2cf052 Compare April 23, 2026 14:34
isaacs added a commit that referenced this pull request Apr 23, 2026
Split the exports from `@sentry/core` into three options:

- `@sentry/core`, the default (unchanged)
- `@sentry/core/browser`, containing _only_ shared and browser-specific
  functionality, nothing server-specific.
- `@sentry/core/server`, containing _only_ shared and server-specific
  functionality, nothing browser-specific.

This should allow us to make the bundle sizes quite a bit smaller in our
browser SDKs where this is important, while adding more functionality to
our server-specific SDKs, in `@sentry/core` where they can be easily
shared across runtimes.

Integration may require updating our `tsconfig` settings so that tsc
knows it is allowed to look on `package.json` exports.

fix: #20434
fix: JS-2243
@isaacs isaacs force-pushed the isaacschlueter/split-server-browser-core-exports branch from e2cf052 to 67bf5c4 Compare April 23, 2026 14:41
Comment thread packages/node-core/src/integrations/http/SentryHttpInstrumentation.ts Outdated
Copy link
Copy Markdown
Collaborator

@timfish timfish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked through most of the changed files.

I guess this doesn't deprecate the old root exports yet?

Comment thread packages/astro/tsconfig.json Outdated
Comment thread packages/browser/tsconfig.json Outdated
Comment thread packages/core/src/integrations/express/index.ts Outdated
isaacs added a commit that referenced this pull request Apr 29, 2026
Split the exports from `@sentry/core` into three options:

- `@sentry/core`, the default (unchanged)
- `@sentry/core/browser`, containing _only_ shared and browser-specific
  functionality, nothing server-specific.
- `@sentry/core/server`, containing _only_ shared and server-specific
  functionality, nothing browser-specific.

This should allow us to make the bundle sizes quite a bit smaller in our
browser SDKs where this is important, while adding more functionality to
our server-specific SDKs in `@sentry/core`, where they can more easily
be shared across runtimes.

Some integration requires updating `tsconfig` settings so that tsc knows
it is allowed to look up `package.json` exports.

fix: #20434
fix: JS-2243
@isaacs isaacs force-pushed the isaacschlueter/split-server-browser-core-exports branch from 67bf5c4 to 2cf15db Compare April 29, 2026 16:41
@isaacs isaacs requested review from a team as code owners April 29, 2026 16:41
isaacs added a commit that referenced this pull request Apr 29, 2026
Split the exports from `@sentry/core` into three options:

- `@sentry/core`, the default (unchanged)
- `@sentry/core/browser`, containing _only_ shared and browser-specific
  functionality, nothing server-specific.
- `@sentry/core/server`, containing _only_ shared and server-specific
  functionality, nothing browser-specific.

This should allow us to make the bundle sizes quite a bit smaller in our
browser SDKs where this is important, while adding more functionality to
our server-specific SDKs in `@sentry/core`, where they can more easily
be shared across runtimes.

Some integration requires updating `tsconfig` settings so that tsc knows
it is allowed to look up `package.json` exports.

fix: #20434
fix: JS-2243
@isaacs isaacs force-pushed the isaacschlueter/split-server-browser-core-exports branch from 2cf15db to c1c9cf0 Compare April 29, 2026 16:46
Comment thread packages/core/src/integrations/http/client-patch.ts Outdated
Comment thread dev-packages/rollup-utils/utils.mjs
isaacs added a commit that referenced this pull request Apr 29, 2026
Split the exports from `@sentry/core` into three options:

- `@sentry/core`, the default (unchanged)
- `@sentry/core/browser`, containing _only_ shared and browser-specific
  functionality, nothing server-specific.
- `@sentry/core/server`, containing _only_ shared and server-specific
  functionality, nothing browser-specific.

This should allow us to make the bundle sizes quite a bit smaller in our
browser SDKs where this is important, while adding more functionality to
our server-specific SDKs in `@sentry/core`, where they can more easily
be shared across runtimes.

Some integration requires updating `tsconfig` settings so that tsc knows
it is allowed to look up `package.json` exports.

fix: #20434
fix: JS-2243
@isaacs isaacs force-pushed the isaacschlueter/split-server-browser-core-exports branch from c1c9cf0 to 5beb2e3 Compare April 29, 2026 17:22
isaacs added a commit that referenced this pull request Apr 29, 2026
Split the exports from `@sentry/core` into three options:

- `@sentry/core`, the default (unchanged)
- `@sentry/core/browser`, containing _only_ shared and browser-specific
  functionality, nothing server-specific.
- `@sentry/core/server`, containing _only_ shared and server-specific
  functionality, nothing browser-specific.

This should allow us to make the bundle sizes quite a bit smaller in our
browser SDKs where this is important, while adding more functionality to
our server-specific SDKs in `@sentry/core`, where they can more easily
be shared across runtimes.

Some integration requires updating `tsconfig` settings so that tsc knows
it is allowed to look up `package.json` exports. In particular, we
cannot use the `module: "node"` option, or `moduleResolution: "node"`.
In many cases, this means either using `module: "esnext"` and
`moduleResolution: "bundler"`, so that tsc lets the bundler handle the
assembly, or `nodenext` or `node16` for both `module` and
`moduleResolution`.

fix: #20434
fix: JS-2243
@isaacs isaacs force-pushed the isaacschlueter/split-server-browser-core-exports branch from 5beb2e3 to ca38b53 Compare April 29, 2026 20:43
Comment thread dev-packages/rollup-utils/utils.mjs Outdated
isaacs added a commit that referenced this pull request Apr 29, 2026
Split the exports from `@sentry/core` into three options:

- `@sentry/core`, the default (unchanged)
- `@sentry/core/browser`, containing _only_ shared and browser-specific
  functionality, nothing server-specific.
- `@sentry/core/server`, containing _only_ shared and server-specific
  functionality, nothing browser-specific.

This should allow us to make the bundle sizes quite a bit smaller in our
browser SDKs where this is important, while adding more functionality to
our server-specific SDKs in `@sentry/core`, where they can more easily
be shared across runtimes.

Some integration requires updating `tsconfig` settings so that tsc knows
it is allowed to look up `package.json` exports. In particular, we
cannot use the `module: "node"` option, or `moduleResolution: "node"`.
In many cases, this means either using `module: "esnext"` and
`moduleResolution: "bundler"`, so that tsc lets the bundler handle the
assembly, or `nodenext` or `node16` for both `module` and
`moduleResolution`.

fix: #20434
fix: JS-2243
@isaacs isaacs force-pushed the isaacschlueter/split-server-browser-core-exports branch from ca38b53 to 24304fe Compare April 29, 2026 20:52
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 24304fe. Configure here.

Comment thread packages/solidstart/test/server/errorboundary.test.tsx Outdated
isaacs added a commit that referenced this pull request Apr 29, 2026
Split the exports from `@sentry/core` into three options:

- `@sentry/core`, the default (unchanged)
- `@sentry/core/browser`, containing _only_ shared and browser-specific
  functionality, nothing server-specific.
- `@sentry/core/server`, containing _only_ shared and server-specific
  functionality, nothing browser-specific.

This should allow us to make the bundle sizes quite a bit smaller in our
browser SDKs where this is important, while adding more functionality to
our server-specific SDKs in `@sentry/core`, where they can more easily
be shared across runtimes.

Some integration requires updating `tsconfig` settings so that tsc knows
it is allowed to look up `package.json` exports. In particular, we
cannot use the `module: "node"` option, or `moduleResolution: "node"`.
In many cases, this means either using `module: "esnext"` and
`moduleResolution: "bundler"`, so that tsc lets the bundler handle the
assembly, or `nodenext` or `node16` for both `module` and
`moduleResolution`.

fix: #20434
fix: JS-2243
@isaacs isaacs force-pushed the isaacschlueter/split-server-browser-core-exports branch from 24304fe to da8cd5a Compare April 29, 2026 21:07
isaacs added a commit that referenced this pull request Apr 29, 2026
Split the exports from `@sentry/core` into three options:

- `@sentry/core`, the default (unchanged)
- `@sentry/core/browser`, containing _only_ shared and browser-specific
  functionality, nothing server-specific.
- `@sentry/core/server`, containing _only_ shared and server-specific
  functionality, nothing browser-specific.

This should allow us to make the bundle sizes quite a bit smaller in our
browser SDKs where this is important, while adding more functionality to
our server-specific SDKs in `@sentry/core`, where they can more easily
be shared across runtimes.

Some integration requires updating `tsconfig` settings so that tsc knows
it is allowed to look up `package.json` exports. In particular, we
cannot use the `module: "node"` option, or `moduleResolution: "node"`.
In many cases, this means either using `module: "esnext"` and
`moduleResolution: "bundler"`, so that tsc lets the bundler handle the
assembly, or `nodenext` or `node16` for both `module` and
`moduleResolution`.

fix: #20434
fix: JS-2243
@isaacs isaacs force-pushed the isaacschlueter/split-server-browser-core-exports branch from da8cd5a to 8fe31cb Compare April 29, 2026 21:19
isaacs added a commit that referenced this pull request Apr 30, 2026
Split the exports from `@sentry/core` into three options:

- `@sentry/core`, the default (unchanged)
- `@sentry/core/browser`, containing _only_ shared and browser-specific
  functionality, nothing server-specific.
- `@sentry/core/server`, containing _only_ shared and server-specific
  functionality, nothing browser-specific.

This should allow us to make the bundle sizes quite a bit smaller in our
browser SDKs where this is important, while adding more functionality to
our server-specific SDKs in `@sentry/core`, where they can more easily
be shared across runtimes.

Some integration requires updating `tsconfig` settings so that tsc knows
it is allowed to look up `package.json` exports. In particular, we
cannot use the `module: "node"` option, or `moduleResolution: "node"`.
In many cases, this means either using `module: "esnext"` and
`moduleResolution: "bundler"`, so that tsc lets the bundler handle the
assembly, or `nodenext` or `node16` for both `module` and
`moduleResolution`.

fix: #20434
fix: JS-2243
@isaacs isaacs force-pushed the isaacschlueter/split-server-browser-core-exports branch from 8fe31cb to 28b47ec Compare April 30, 2026 00:05
Comment thread packages/core/src/server-exports.ts
Split the exports from `@sentry/core` into three options:

- `@sentry/core`, the default (unchanged)
- `@sentry/core/browser`, containing _only_ shared and browser-specific
  functionality, nothing server-specific.
- `@sentry/core/server`, containing _only_ shared and server-specific
  functionality, nothing browser-specific.

This should allow us to make the bundle sizes quite a bit smaller in our
browser SDKs where this is important, while adding more functionality to
our server-specific SDKs in `@sentry/core`, where they can more easily
be shared across runtimes.

Some integration requires updating `tsconfig` settings so that tsc knows
it is allowed to look up `package.json` exports. In particular, we
cannot use the `module: "node"` option, or `moduleResolution: "node"`.
In many cases, this means either using `module: "esnext"` and
`moduleResolution: "bundler"`, so that tsc lets the bundler handle the
assembly, or `nodenext` or `node16` for both `module` and
`moduleResolution`.

fix: #20434
fix: JS-2243
@isaacs isaacs force-pushed the isaacschlueter/split-server-browser-core-exports branch from 28b47ec to a783c2e Compare April 30, 2026 00:25
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.

Split @sentry/core exports up, adding ./server and ./browser exports

3 participants