Skip to content

Prevent crash when using @tailwindcss/cli using --watch on Windows#20242

Merged
RobinMalfait merged 4 commits into
mainfrom
fix/issue-20231
Jun 15, 2026
Merged

Prevent crash when using @tailwindcss/cli using --watch on Windows#20242
RobinMalfait merged 4 commits into
mainfrom
fix/issue-20231

Conversation

@RobinMalfait

@RobinMalfait RobinMalfait commented Jun 15, 2026

Copy link
Copy Markdown
Member

This PR fixes an issue on Windows where the @tailwindcss/cli with the --watch flag crashes when using a @source with a base path that doesn't exist on disk.

This happens when setting up the @parce/watcher for directories that don't exist. This PR essentially filters out these directories that don't exist on disk to prevent the crash.

It might be that if you add the folder later, while the watcher is already watching, that you have to restart the @tailwindcss/cli (or save the index.css (the file that contains the @source directives), this also recreates watchers from scratch).

If this issue causes problems for @tailwindcss/postcss and @tailwindcss/vite in the future as well, then we can move this logic back to Oxide. We do maintain the incoming @source files as best as possible without resolving to absolute paths. Back when we did resolve them, if that process error'd we just never returned the glob.

The root cause is still referencing folders that don't exist.

Fixes: #20231

Test plan

  1. Added a failing test, that did fail on Windows
  2. Once fixed, all tests should pass

[ci-all]

At least at this point in time. We'll pass through the absolutely
resolved real path.
@RobinMalfait RobinMalfait marked this pull request as ready for review June 15, 2026 15:18
@RobinMalfait RobinMalfait requested a review from a team as a code owner June 15, 2026 15:18
@greptile-apps

greptile-apps Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

Safe to merge — the change is narrowly scoped to filtering non-existent paths before setting up file watchers, with no effect on the build pipeline itself.

The fix is minimal and well-contained: only watchDirectories changes, both call sites are correctly awaited, error paths fall back safely to an empty array, and the integration test reproduces the crash scenario on Windows. There are no behavioral changes to the compilation or scanning logic.

No files require special attention.

Reviews (2): Last reviewed commit: "Update integrations/cli/index.test.ts" | Re-trigger Greptile

Comment thread integrations/cli/index.test.ts Outdated
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
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.

v4.3.1 CLI fails with [Error: Invalid handle] when @source present

1 participant