Skip to content

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

Draft
isaacs wants to merge 4 commits intodevelopfrom
isaacschlueter/split-server-browser-core-exports
Draft

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

Conversation

@isaacs
Copy link
Copy Markdown
Member

@isaacs isaacs commented Apr 21, 2026

Note: stacked atop #20393, only the top commit needs review. Land that before this one.

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

isaacs added 3 commits April 21, 2026 09:19
This was implemented for the portable Express integration, but others
will need the same functionality, so make it a reusable util.
Refactor the `node:http` outgoing request instrumentation so that it can
be applied to non-Node.js environments by patching the http module.

Also, refactor so that the diagnostics_channel and monkeypatching paths
can share code, and so that light and normal node-core instrumentations
can share more of the functionality as well.

To facilitate this, some portable minimal types are vendored in from the
`node:http` module.
@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 5 times, most recently from 1094a34 to 143a2a5 Compare April 22, 2026 01:44
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 143a2a5 to 1494709 Compare April 22, 2026 01:45
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

1 participant