Skip to content

[@cloudflare/vite-plugin] Unexpected Node.js imports #12194

@magne4000

Description

@magne4000

What versions & operating system are you using?

System:
OS: Linux 6.18 CachyOS Linux
CPU: (16) x64 AMD Ryzen 7 5800X 8-Core Processor
Memory: 20.19 GB / 31.25 GB
Container: Yes
Shell: 4.3.3 - /bin/fish
Binaries:
Node: 24.13.0 - /home/magne/.local/share/mise/installs/node/24.13.0/bin/node
npm: 11.6.2 - /home/magne/.local/share/mise/installs/node/24.13.0/bin/npm
pnpm: 10.24.0 - /home/magne/.local/share/mise/installs/node/24.13.0/bin/pnpm
bun: 1.3.5 - /usr/bin/bun
Deno: 2.6.5 - /usr/bin/deno
npmPackages:
@cloudflare/vite-plugin: ^1.21.2 => 1.21.2
wrangler: ^4.60.0 => 4.60.0

Please provide a link to a minimal reproduction

vikejs/vike-photon#52

Describe the Bug

esbuildOptions plugin incorrectly warns about Node.js imports in Cloudflare Workers builds due to stale dependency cache. The warnings reference dependencies that aren't actually used in the current entry point, suggesting a caching or race condition issue.

All relevant information are located in this issue vikejs/vike-photon#52 (comment), with more details on reproduction steps and in depth analysis.

Please provide any relevant error logs

[vite] Unexpected Node.js imports for environment "ssr"
 - "node:http" imported from "node_modules/.pnpm/fastify@5.7.1/node_modules/fastify/fastify.js"

Metadata

Metadata

Labels

vite-pluginRelating to the `@cloudflare/vite-plugin` package

Type

Projects

Status

Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions