Skip to content

Commit e5b74a1

Browse files
authored
fix(tanstackstart-react): Add workerd and worker export conditions (#19461)
## Problem When deploying a TanStack Start application to Cloudflare Workers, importing `@sentry/tanstackstart-react` causes a build failure. The `@cloudflare/vite-plugin` configures resolve conditions as `["workerd", "worker", "module", "browser"]` for the SSR environment. Since this package only defines `browser` and `node` conditions, the resolver falls through to `browser`, which points to `index.client.js`. TanStack Start's import-protection plugin denies files matching `**/*.client.*` in the server environment, causing the build to fail. Related: TanStack/router#6688 ## Solution Add `workerd` and `worker` export conditions to the `.` entry in `package.json`, pointing to `index.server.js` (the same target as the `node` condition). This ensures that bundlers targeting Workers runtimes resolve to the server entry rather than falling through to the `browser` condition. Users deploying to Cloudflare Workers will need `nodejs_compat` enabled in their wrangler configuration for `@sentry/node` to function correctly at runtime. A dedicated Cloudflare entrypoint (without `@sentry/node` dependency) will be addressed in a follow-up PR. ## Changed files | File | Change | |---|---| | `packages/tanstackstart-react/package.json` | Add `workerd` and `worker` export conditions pointing to `index.server.js` |
1 parent 413041a commit e5b74a1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

packages/tanstackstart-react/package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@
1919
"./package.json": "./package.json",
2020
".": {
2121
"types": "./build/types/index.types.d.ts",
22+
"workerd": {
23+
"import": "./build/esm/index.server.js",
24+
"require": "./build/cjs/index.server.js"
25+
},
26+
"worker": {
27+
"import": "./build/esm/index.server.js",
28+
"require": "./build/cjs/index.server.js"
29+
},
2230
"browser": {
2331
"import": "./build/esm/index.client.js",
2432
"require": "./build/cjs/index.client.js"

0 commit comments

Comments
 (0)