Workers SDK Issue Reports

← Back to Dashboard

#10170 [vitest-pool-workers, vite-plugin]: Adding workers vitest integration to cloudflare react router template causes error: The entry point "react" cannot be marked as external

Recommendation:KEEP OPEN
Difficulty:medium
Reasoning:

Bug still reproduces with latest versions (vite-plugin 1.21.2, vitest-pool-workers 0.12.6). Fundamental incompatibility between vitest-pool-workers esbuild externals handling and React Router plugin.

Suggested Action:

Keep open for investigation by vitest-pool-workers/vite-plugin team.

Analysis Report

Issue Review: cloudflare/workers-sdk#10170

Summary

Using defineWorkersConfig with @cloudflare/vite-plugin and React Router causes esbuild error: "The entry point 'react' cannot be marked as external"

Findings

  • Created: 2025-08-01
  • Updated: 2025-10-13
  • Version: vitest-pool-workers 0.8.59 / vite-plugin 1.11.0 -> vitest-pool-workers 0.12.6 / vite-plugin 1.21.2
  • Component: vitest-pool-workers, vite-plugin
  • Labels: bug, vitest, vite-plugin
  • Comments: 0

Key Evidence

  • No PRs found that explicitly fix this issue
  • No changelog entries referencing this issue number
  • Issue still reproduces with latest versions:
    • @cloudflare/vitest-pool-workers: 0.12.6
    • @cloudflare/vite-plugin: 1.21.2
    • wrangler: 4.60.0
    • vitest: 3.2.4
    • vite: 7.1.1
  • Error occurs during esbuild dependency optimization when using defineWorkersConfig with React Router plugin
  • The alternative config (without defineWorkersConfig) no longer works either with latest versions

Reproduction Result

Successfully reproduced using reporter's repository: https://github.com/mw10013/cloudflare-react-router-vitest

npm test

✘ [ERROR] The entry point "react" cannot be marked as external

Error: Error during dependency optimization:

Recommendation

Status: KEEP OPEN

Reasoning: This is a valid, confirmed bug that still reproduces with the latest versions of all involved packages. There is a fundamental incompatibility between vitest-pool-workers and React Router when using defineWorkersConfig. No fix has been merged and the issue affects users wanting to test Workers with React Router.

Action: Keep open for developer investigation. The issue needs attention from the vitest-pool-workers/vite-plugin team to resolve the conflict with how React (and similar frameworks) handle externals vs. how vitest-pool-workers configures esbuild.

Notes & Feedback (0)

No notes yet.

Add Note