tailwindcss: CLI Watch never end 2 CPU cores at 100%

What version of Tailwind CSS are you using?

v4.0.14

What version of Node.js are you using?

v20.18.0

What operating system are you using?

Windows 11

Reproduction URL

I just use the Tailwind4 directory of https://github.com/pinzonjulian/tailwind_css_cli_watch_bug.git

git clone https://github.com/pinzonjulian/tailwind_css_cli_watch_bug.git
cd tailwind4
npm install tailwindcss @tailwindcss/cli
npx @tailwindcss/cli -i input.css -o output.css --watch

Describe your issue

Command never end, there is no output, 2 cores at 100%.

If I remove output.css, the process don’t create it.

When I remove --watch. It works :

> $env:DEBUG=1; npx @tailwindcss/cli -i input.css -o output.css
≈ tailwindcss v4.0.14

Done in 91ms

[95.04ms] [@tailwindcss/cli] (initial build)
[14.09ms]   ↳ Setup compiler
[38.04ms]   ↳ Scan for candidates
[33.33ms]   ↳ Build CSS
[ 1.06ms]   ↳ Write output

Could a global configuration be the cause of the problem?

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 1
  • Comments: 26 (10 by maintainers)

Most upvoted comments

Try the following parcel script and let me know if the inclusion of that ignore option makes any difference

It doesn’t seem to make a difference for me. It takes about 1m32s with or without the ignore parameter.

I tried starting the rails app in my repro Linux VM but even though my tmp dir looks the same, it doesn’t take that long to start. That said I’m on a Hetzner VPS where they do claim that they use NVMe drives so that might explain why it’s fast for me. 🤔

So I naturally duplicated the tmp/ folder a dozen times and now it’s getting slower (4sec already!). This does indeed seem like the issue is related to #15750.

Image

Now let me try if that ignore setup would work.

I can reproduce what seems to be this issue when I have watchman installed; and it goes away when I uninstall watchman.

With watchman installed, on a Linux x86_64 GNU libc system (native, not in a container) running with DEBUG=1, I see:

22:14:29 css.1  | [81399.36ms] [@tailwindcss/cli] (initial build)
22:14:29 css.1  | [   12.32ms]   ↳ Setup compiler
22:14:29 css.1  | [   33.67ms]   ↳ Scan for candidates
22:14:29 css.1  | [   11.92ms]   ↳ Build CSS
22:14:29 css.1  | [    1.04ms]   ↳ Optimize CSS
22:14:29 css.1  | [    1.03ms]   ↳ Write output

The initial startup takes 81 seconds. After that startup, everything seems responsive and changes to files result in:

22:15:42 css.1  | Done in 1ms
22:15:42 css.1  |
22:15:42 css.1  | [1.34ms] [@tailwindcss/cli] (watcher)
22:15:42 css.1  | [1.13ms]   ↳ Scan for candidates

Without watchman installed, though, startup is 1000x faster:

22:16:59 css.1  | Done in 71ms
22:16:59 css.1  |
22:16:59 css.1  | [71.90ms] [@tailwindcss/cli] (initial build)
22:16:59 css.1  | [12.04ms]   ↳ Setup compiler
22:16:59 css.1  | [26.72ms]   ↳ Scan for candidates
22:16:59 css.1  | [15.86ms]   ↳ Build CSS
22:16:59 css.1  | [ 1.23ms]   ↳ Optimize CSS
22:16:59 css.1  | [ 0.81ms]   ↳ Write output

@lenart The issue you’re running into might be https://github.com/tailwindlabs/tailwindcss/issues/17379 and is unrelated to watch mode. Do you mind taking a look there and, if possible, can provide us with a reproduction of that issue? Thanks!