feat(watcher): enable rspack native watcher#1441
Conversation
|
Held as draft — blocked on an upstream rspack 2.1 source-map regression. CI fails on 3 non-watcher e2e tests ( The call-site column now resolves to the source
Root cause confirmed via minimal repro + source-map decode. Not configurable (tested Holding this PR until the upstream regression is fixed; the task locations will then snap back without any test changes here. |
0dfdb18 to
23c54f1
Compare
Turn on experiments.nativeWatcher now that rsbuild 2.1's safeTime baseline suppresses the stale-FSEvent reruns that used to flake macOS watch e2e. - watch aggregateTimeout 5 -> 100ms (macOS FSEvent/vnode cache cycle) - poll config files for restart (chokidar v5 dropped fsevents) - await chokidar 'ready' so pre-ready events are not dropped
23c54f1 to
4ca5684
Compare
Why
Rstest uses the JS file watcher in watch mode because rspack's native (Rust) watcher had a macOS flake — stale FSEvents replayed an empty rerun (
expected '' to match 'other.test.ts'), failing ~7.5% on macos-14 runners.That root cause is fixed upstream and shipped in rspack 2.1 (
safeTime/FS_ACCURACYgranularity-safe scan + ignored-subtree event filtering).mainalready runs on released@rsbuild/core ~2.1.4/@rspack/core ~2.1.2, so the fix is already in place — this PR only flips the watcher on, no version bump.Validation: the native watcher was stress-tested on macos-14 (node 22/24, path-reuse condition) for 700+ watch runs across the upstream fix series — zero watcher flake. The released 2.1.x line is a superset of those builds; local macOS re-run on 2.1.4 is 10/10 green.
What
experiments.nativeWatcherin watch mode.aggregateTimeout5 → 100ms— on macOS the native watcher needs the FSEvent → vnode cache invalidation window to elapse before rspack stats the changed file, otherwise the rebuild reads stale content. Drop the now-redundant per-fixtureaggregateTimeout: 10overrides in the watch e2e configs so this default applies.fs.watchsilently drops single-file change events on macOS) and await the initial scan so the first change is never missed.