Turbopack: Make the "non-recursive" logic for the fs watcher a runtime flag…
Turbopack: Make the "non-recursive" logic for the fs watcher a runtime flag instead of a build-time one (#82031) We use different modes on macos/windows and linux for watching files for performance reasons: https://github.com/vercel/turborepo/pull/4100 Now with `TURBO_TASKS_FORCE_WATCH_MODE=recursive` or `TURBO_TASKS_FORCE_WATCH_MODE=nonrecursive`, you can force the watcher into either mode, independent of platform. ### Why? - Platform-specific compilation flags are annoying and it's easy to accidentally break compilation on another platform. - It's actually really useful to be able to force recursive or non-recursive mode without switching platforms when testing the watcher to narrow down bugs. E.g. on Linux: ``` # this fails to receive watch events after directories are added/removed rm -rf /tmp/fuzz && RUST_BACKTRACE=1 TURBO_TASKS_FORCE_WATCH_MODE=nonrecursive cargo run --release -p turbo-tasks-fuzz -- fs-watcher --fs-root /tmp/fuzz # but this (simulating the behavior of macos/windows) works fine rm -rf /tmp/fuzz && RUST_BACKTRACE=1 TURBO_TASKS_FORCE_WATCH_MODE=recursive cargo run --release -p turbo-tasks-fuzz -- fs-watcher --fs-root /tmp/fuzz ``` - There's not all that many places this flag needs to be checked, and compared to the cost of the syscalls happening at those callsites, the impact should be basically zero.
Showing
This diff is collapsed.
Please
register
or
sign in
to comment