What versions & operating system are you using?
System:
OS: macOS 26.3
CPU: (10) arm64 Apple M1 Pro
Memory: 84.08 MB / 32.00 GB
Shell: 5.9 - /opt/homebrew/bin/zsh
Binaries:
Node: 22.22.0 - /Users/otto/.volta/tools/image/node/22.22.0/bin/node
Yarn: 4.3.0 - /Users/otto/.volta/tools/image/yarn/4.3.0/bin/yarn
npm: 10.9.4 - /Users/otto/.volta/tools/image/node/22.22.0/bin/npm
pnpm: 10.28.2 - /Users/otto/.volta/tools/image/pnpm/10.28.2/bin/pnpm
Deno: 1.45.5 - /Users/otto/.deno/bin/deno
Watchman: 2026.01.12.00 - /opt/homebrew/bin/watchman
npmPackages:
@cloudflare/vite-plugin: ^1.29.1 => 1.30.0
@cloudflare/vitest-pool-workers: ^0.13.3 => 0.13.3
@cloudflare/workers-types: ^4.20260317.1 => 4.20260317.1
wrangler: ^4.75.0 => 4.76.0
Please provide a link to a minimal reproduction
https://github.com/hansottowirtz/cf-workers-pg-vitest-repro
Describe the Bug
Using Vitest pool workers with Vite 8 breaks importing pg in tests.
Here is a repro: https://github.com/hansottowirtz/cf-workers-pg-vitest-repro (just run pnpm test there)
Errors are:
- strange "Cannot use import statement outside a module" issue, can be worked around by adding pg to test.deps.optimizer.ssr.include
- then, builtin node modules imported by pg are not externalized correctly, this can be worked around with the commented block in vitest.config.ts
- then, using pg causes the Cannot perform I/O on behalf of a different Durable Object. I/O objects error.
If you want I can add it into vitest-pool-workers-examples as well, if that runs as part of CI.
Related: #12947
Please provide any relevant error logs
No response
What versions & operating system are you using?
System:
OS: macOS 26.3
CPU: (10) arm64 Apple M1 Pro
Memory: 84.08 MB / 32.00 GB
Shell: 5.9 - /opt/homebrew/bin/zsh
Binaries:
Node: 22.22.0 - /Users/otto/.volta/tools/image/node/22.22.0/bin/node
Yarn: 4.3.0 - /Users/otto/.volta/tools/image/yarn/4.3.0/bin/yarn
npm: 10.9.4 - /Users/otto/.volta/tools/image/node/22.22.0/bin/npm
pnpm: 10.28.2 - /Users/otto/.volta/tools/image/pnpm/10.28.2/bin/pnpm
Deno: 1.45.5 - /Users/otto/.deno/bin/deno
Watchman: 2026.01.12.00 - /opt/homebrew/bin/watchman
npmPackages:
@cloudflare/vite-plugin: ^1.29.1 => 1.30.0
@cloudflare/vitest-pool-workers: ^0.13.3 => 0.13.3
@cloudflare/workers-types: ^4.20260317.1 => 4.20260317.1
wrangler: ^4.75.0 => 4.76.0
Please provide a link to a minimal reproduction
https://github.com/hansottowirtz/cf-workers-pg-vitest-repro
Describe the Bug
Using Vitest pool workers with Vite 8 breaks importing pg in tests.
Here is a repro: https://github.com/hansottowirtz/cf-workers-pg-vitest-repro (just run pnpm test there)
Errors are:
If you want I can add it into vitest-pool-workers-examples as well, if that runs as part of CI.
Related: #12947
Please provide any relevant error logs
No response