Skip to content

Commit 81a466d

Browse files
antonisclaude
andcommitted
fix(core): Include subpath type shims in published package
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>
1 parent 28d6fe5 commit 81a466d

3 files changed

Lines changed: 17 additions & 1 deletion

File tree

packages/core/browser.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// This file is a compatibility shim for TypeScript compilers that do not
2+
// support the package.json `exports` field for resolving subpath exports.
3+
// Note: `typesVersions` in package.json may redirect this to the downleveled variant.
4+
export * from './build/types/browser';

packages/core/package.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
"files": [
1313
"/build",
1414
"browser.js",
15-
"server.js"
15+
"browser.d.ts",
16+
"server.js",
17+
"server.d.ts"
1618
],
1719
"main": "build/cjs/index.js",
1820
"module": "build/esm/index.js",
@@ -54,6 +56,12 @@
5456
"<5.0": {
5557
"build/types/index.d.ts": [
5658
"build/types-ts3.8/index.d.ts"
59+
],
60+
"browser": [
61+
"build/types-ts3.8/browser.d.ts"
62+
],
63+
"server": [
64+
"build/types-ts3.8/server.d.ts"
5765
]
5866
}
5967
},

packages/core/server.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// This file is a compatibility shim for TypeScript compilers that do not
2+
// support the package.json `exports` field for resolving subpath exports.
3+
// Note: `typesVersions` in package.json may redirect this to the downleveled variant.
4+
export * from './build/types/server';

0 commit comments

Comments
 (0)