Commit 8024203
committed
fix(test): resolve ws CJS named export error with cloudflare preset
closes #831
When Nuxt's cloudflare preset is active, vitest passes `--conditions browser`
to worker processes. This caused `ws` to resolve to its browser stub
(`ws/browser.js`) instead of the ESM wrapper (`ws/wrapper.mjs`), because
the test package's `node` export condition loaded `index-node.js` which
imports `@vitest/browser/index.js` → `ws`.
Fix by adding a `browser` export condition before `node` in the test
package's main export. When `--conditions browser` is active, `browser`
matches first and resolves to `dist/index.js` (which doesn't pull in
`@vitest/browser`), avoiding the ws resolution issue.
Also fix ecosystem-ci `patch-project.ts` to apply pnpm overrides for
projects that already use Vite+ (previously skipped by `vp migrate`),
and add the reproduction repo as an e2e test case.1 parent fdd44d0 commit 8024203
4 files changed
Lines changed: 19 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
246 | 246 | | |
247 | 247 | | |
248 | 248 | | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
249 | 253 | | |
250 | 254 | | |
251 | 255 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
57 | 62 | | |
58 | 63 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
302 | 302 | | |
303 | 303 | | |
304 | 304 | | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
305 | 313 | | |
306 | 314 | | |
307 | 315 | | |
| 316 | + | |
308 | 317 | | |
309 | 318 | | |
310 | 319 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
0 commit comments