Skip to content

fix(scan): use fileURLToPath for the entrypoint scan root (Windows) - #296

Merged
thejackshelton merged 1 commit into
QwikDev:build/v2from
dustinlacewell:fix/scan-cwd-windows
Sep 2, 2026
Merged

fix(scan): use fileURLToPath for the entrypoint scan root (Windows)#296
thejackshelton merged 1 commit into
QwikDev:build/v2from
dustinlacewell:fix/scan-cwd-windows

Conversation

@dustinlacewell

Copy link
Copy Markdown
Contributor

Problem

scanQwikEntrypoints uses config.root.pathname as the cwd for the grep spawn and as the base for resolve(). On Windows that value is /C:/project/, which is not a valid filesystem path. spawn fails with ENOENT, grepQwikFiles swallows the error and returns "", so:

  • no entrypoints are detected,
  • the standalone client build is skipped,
  • every QRL reports a Q14 error during prerender.

Reproduction on Windows with the code from 1.1.0:

pathname: /D:/code/site/
ERR ENOENT spawn grep ENOENT

grep itself is on PATH (Git for Windows). The cwd is the failure.

Fix

Convert the root URL with fileURLToPath(config.root). That yields a native path on every platform, so both the cwd and the resolved absolute entrypoint paths are correct. One line, no behaviour change on POSIX.

This is the minimal version of #292. It does not add a Node fallback for hosts without grep; it only fixes the path.

Tests

Added scanQwikEntrypoints unit tests that scan a real temp directory (one Qwik file, one plain file, one match under node_modules) and assert the native absolute path is returned and the filter is honoured. The first test fails on the current code on Windows and passes with the fix.

Note: two pre-existing resolveQwikPaths tests already fail on Windows because they compare against /-separated strings. Left out of scope here.

scanQwikEntrypoints used config.root.pathname as the grep cwd and as the
base for resolve(). On Windows that value is "/C:/project/", which is not
a valid filesystem path: spawn fails with ENOENT, the error is swallowed,
no entrypoints are found, the standalone client build is skipped, and
every QRL reports Q14 during prerender.

Convert the root URL with fileURLToPath so the cwd and the resolved
absolute paths are native on every platform. Add unit tests that scan a
real temp directory.
@changeset-bot

changeset-bot Bot commented Sep 2, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 9c90d2f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@thejackshelton thejackshelton left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@thejackshelton
thejackshelton merged commit e25e423 into QwikDev:build/v2 Sep 2, 2026
26 of 29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants