Commit e5b74a1
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
1 file changed
+8
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
22 | 30 | | |
23 | 31 | | |
24 | 32 | | |
| |||
0 commit comments