Skip to content

fix(core): Include subpath type shims in published package - #20835

Merged
JPeer264 merged 1 commit into
developfrom
fix/core-subpath-type-shims
May 12, 2026
Merged

fix(core): Include subpath type shims in published package#20835
JPeer264 merged 1 commit into
developfrom
fix/core-subpath-type-shims

Conversation

@antonis

Copy link
Copy Markdown
Contributor

Summary

  • Adds browser.d.ts and server.d.ts to the files list in @sentry/corepackage.json so they are included in the published npm tarball
  • Adds typesVersions entries for browser and server subpaths to support TypeScript < 5.0

Context

PR #20435 introduced @sentry/core/browser and @sentry/core/server subpath exports and added root-level .d.ts shim files for compatibility with TypeScript compilers that don't support the exports field (e.g. moduleResolution: "node"). However, the .d.ts shims were not added to the files list, so they were excluded from the published 10.53.0 tarball.

This breaks downstream consumers like @sentry/react-native (getsentry/sentry-react-native#6139) — their TS compiler can't resolve @sentry/core/browser, causing BaseTransportOptions to become unresolvable and ReactNativeTransportOptions to fail the type constraint check:

error TS2344: Type 'ReactNativeTransportOptions' does not satisfy the constraint 'BaseTransportOptions'.
Type 'ReactNativeTransportOptions' is missing the following properties from type 'BaseTransportOptions': url, recordDroppedEvent

Test plan

  • Verify npm pack --dry-run includes browser.d.ts and server.d.ts at the package root
  • Verify @sentry/react-native builds successfully against a patched @sentry/core

🤖 Generated with Claude Code

The `browser.d.ts` and `server.d.ts` root-level shims were missing from
the `files` list, so TypeScript compilers using `moduleResolution: "node"`
(which don't support the `exports` field) couldn't resolve
`@sentry/core/browser` or `@sentry/core/server` types. This broke
downstream consumers like `@sentry/react-native`.
Also adds `typesVersions` entries for the browser/server subpaths to
support TypeScript < 5.0.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

⚠️Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

PathSize% ChangeChange
@sentry/browser26.84 kB--
@sentry/browser - with treeshaking flags25.28 kB--
@sentry/browser (incl. Tracing)44.73 kB--
@sentry/browser (incl. Tracing + Span Streaming)46.73 kB--
@sentry/browser (incl. Tracing, Profiling)49.73 kB--
@sentry/browser (incl. Tracing, Replay)84.38 kB--
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags73.81 kB--
@sentry/browser (incl. Tracing, Replay with Canvas)89.08 kB--
@sentry/browser (incl. Tracing, Replay, Feedback)101.71 kB--
@sentry/browser (incl. Feedback)44.03 kB--
@sentry/browser (incl. sendFeedback)31.66 kB--
@sentry/browser (incl. FeedbackAsync)36.77 kB--
@sentry/browser (incl. Metrics)27.93 kB--
@sentry/browser (incl. Logs)28.08 kB--
@sentry/browser (incl. Metrics & Logs)28.75 kB--
@sentry/react28.59 kB--
@sentry/react (incl. Tracing)47.01 kB--
@sentry/vue31.75 kB--
@sentry/vue (incl. Tracing)46.59 kB--
@sentry/svelte26.86 kB--
CDN Bundle29.24 kB--
CDN Bundle (incl. Tracing)47.16 kB--
CDN Bundle (incl. Logs, Metrics)30.61 kB--
CDN Bundle (incl. Tracing, Logs, Metrics)48.28 kB--
CDN Bundle (incl. Replay, Logs, Metrics)69.94 kB--
CDN Bundle (incl. Tracing, Replay)84.55 kB--
CDN Bundle (incl. Tracing, Replay, Logs, Metrics)85.62 kB--
CDN Bundle (incl. Tracing, Replay, Feedback)90.36 kB--
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics)91.46 kB--
CDN Bundle - uncompressed85.99 kB--
CDN Bundle (incl. Tracing) - uncompressed141.47 kB--
CDN Bundle (incl. Logs, Metrics) - uncompressed90.18 kB--
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed144.93 kB--
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed215.01 kB--
CDN Bundle (incl. Tracing, Replay) - uncompressed260.18 kB--
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed263.62 kB--
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed273.87 kB--
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed277.31 kB--
@sentry/nextjs (client)49.52 kB--
@sentry/sveltekit (client)45.23 kB--
@sentry/node-core60.84 kB+0.02%+11 B 🔺
@sentry/node165.98 kB+0.01%+10 B 🔺
@sentry/node - without tracing73.96 kB+0.01%+7 B 🔺
@sentry/aws-serverless108.07 kB+0.01%+6 B 🔺
@sentry/cloudflare (withSentry) - minified170.66 kB--
@sentry/cloudflare (withSentry)430.47 kB--

View base workflow run

@JPeer264JPeer264 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Amazing thanks a lot

@JPeer264
JPeer264 merged commit 5881009 into developMay 12, 2026
522 of 524 checks passed
@JPeer264
JPeer264 deleted the fix/core-subpath-type-shims branch May 12, 2026 14:07
Sign up for freeto 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.

2 participants

@antonis@JPeer264