fix(tanstackstart-react): remove misleading workerd/worker export conditions#20039
Conversation
… conditions (getsentry#20038) The `workerd` and `worker` export conditions in `package.json` both resolve to `index.server.js`, which re-exports `@sentry/node`. This falsely signals Cloudflare Workers compatibility — bundlers targeting Workers resolve the `workerd` condition and pull the full `@sentry/node` dependency tree (including OpenTelemetry, undici, and `node:*` built-ins) into the Worker bundle, causing silent module evaluation failure at runtime. Remove these conditions so that Workers bundlers fall through to `browser` (which resolves to `index.client.js` / `@sentry/browser`). This is a packaging stopgap — proper Workers support would require a dedicated entry using `@sentry/cloudflare`, tracked in getsentry#18669.
|
This PR has been automatically closed. The referenced issue is already assigned to someone else. If you believe this assignment is outdated, please comment on the issue to discuss before opening a new PR. Please review our contributing guidelines for more details. |
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨Deps
Nuxt
Other
Bug Fixes 🐛Ci
Other
Documentation 📚
Internal Changes 🔧Core
Deps
Deps Dev
Other
🤖 This preview updates automatically when you update the PR. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| "worker": { | ||
| "import": "./build/esm/index.server.js", | ||
| "require": "./build/cjs/index.server.js" | ||
| }, |
There was a problem hiding this comment.
Fix PR lacks test for the regression
Low Severity
This is a fix PR but includes no unit, integration, or E2E test verifying that the regression (silent Worker crashes from the workerd/worker conditions resolving to @sentry/node) is fixed. Per the review rules, fix PRs need at least one test that would have failed before the fix and passes after it — e.g., a test asserting that the "." exports map no longer contains workerd or worker conditions, or an integration test confirming correct resolution for Workers bundlers.
Triggered by project rule: PR Review Guidelines for Cursor Bot


Summary
Removes the
workerdandworkerexport conditions from@sentry/tanstackstart-react'spackage.json. These conditions currently resolve toindex.server.js— the same entry asnode— which re-exports@sentry/node. This falsely signals Cloudflare Workers compatibility and causes silent Worker crashes when bundlers resolve theworkerdcondition.What changed: Deleted the
workerdandworkerblocks from the"."exports map. Workers bundlers will now fall through tobrowser→index.client.js(which uses@sentry/browser, safe for Workers).Caveats (for the team to evaluate):
browserdepends on the bundler's condition set includingbrowser. Adding adefaultcondition pointing to the client entry would be more robust (Node docs), but that's a broader design decision.browser/client entry does not exportwrapFetchWithSentry, so Workers consumers using that import would get a build error. In practice this is an improvement — a build error is far better than the current silent runtime crash.Longer-term: Proper Workers support would need a dedicated entry using
@sentry/cloudflareinstead of@sentry/node— multiple server source files (sdk.ts,wrapFetchWithSentry.ts,middleware.ts) import@sentry/nodedirectly, not just the barrel. This is tracked in #18669.Fixes #20038
References
@sentry/nextjson Cloudflare Workers #18843, Support Next.js on Cloudflare Workers (OpenNext) #14931, React Router v7 deployed to Cloudflare Workers #16130