[GH-ISSUE #129] App Router tests fail when project path contains spaces #28

Closed
opened 2026-05-06 12:36:39 +02:00 by BreizhHardware · 0 comments

Originally created by @gentritbiba on GitHub (Feb 26, 2026).
Original GitHub issue: https://github.com/cloudflare/vinext/issues/129

Bug

When the project is located in a directory path containing spaces (e.g. ~/Google Drive/Code/vinext), all App Router, RSC, and nextjs-compat tests fail with:

Failed to load url /path/with%20spaces/packages/vinext/src/server/metadata-routes.js
(resolved id: .../metadata-routes.js) in virtual:vinext-rsc-entry. Does the file exist?

Root Cause

In packages/vinext/src/server/app-dev-server.ts line 220, the virtual RSC entry codegen uses:

new URL("./metadata-routes.js", import.meta.url).pathname.replace(/\\/g, "/")

URL.pathname returns percent-encoded strings (e.g. %20 for spaces). Vite cannot resolve the file at the encoded path.

Fix

Use fileURLToPath() from node:url instead of .pathname, which properly decodes the URL to a filesystem path. This is already done correctly elsewhere in the codebase (e.g. cloudflare/tpr.ts:613).

Impact

  • 19 out of 50 test files fail (271 tests) when the project path has spaces
  • Affects all App Router / RSC / nextjs-compat tests
  • Common on macOS (iCloud Drive, Google Drive, OneDrive all use spaces)
  • Pages Router and unit tests are unaffected
Originally created by @gentritbiba on GitHub (Feb 26, 2026). Original GitHub issue: https://github.com/cloudflare/vinext/issues/129 ## Bug When the project is located in a directory path containing spaces (e.g. `~/Google Drive/Code/vinext`), all App Router, RSC, and `nextjs-compat` tests fail with: ``` Failed to load url /path/with%20spaces/packages/vinext/src/server/metadata-routes.js (resolved id: .../metadata-routes.js) in virtual:vinext-rsc-entry. Does the file exist? ``` ## Root Cause In `packages/vinext/src/server/app-dev-server.ts` line 220, the virtual RSC entry codegen uses: ```ts new URL("./metadata-routes.js", import.meta.url).pathname.replace(/\\/g, "/") ``` `URL.pathname` returns percent-encoded strings (e.g. `%20` for spaces). Vite cannot resolve the file at the encoded path. ## Fix Use `fileURLToPath()` from `node:url` instead of `.pathname`, which properly decodes the URL to a filesystem path. This is already done correctly elsewhere in the codebase (e.g. `cloudflare/tpr.ts:613`). ## Impact - **19 out of 50 test files fail** (271 tests) when the project path has spaces - Affects all App Router / RSC / nextjs-compat tests - Common on macOS (iCloud Drive, Google Drive, OneDrive all use spaces) - Pages Router and unit tests are unaffected
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vinext#28
No description provided.