From 1177817aba3b620395df6d5ae472b5ced9495908 Mon Sep 17 00:00:00 2001
From: Paul Buschmann
Date: Mon, 21 Jul 2025 20:16:46 +0200
Subject: [PATCH 1/2] fix: listen to windows event
---
rewatch/src/watcher.rs | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/rewatch/src/watcher.rs b/rewatch/src/watcher.rs
index b0cb187c97..09b1c6bc15 100644
--- a/rewatch/src/watcher.rs
+++ b/rewatch/src/watcher.rs
@@ -146,16 +146,20 @@ async fn async_watch(
) => {
// if we are going to do a full compile, we don't need to bother marking
// files dirty because we do a full scan anyway
+ log::debug!("received {:?} while needs_compile_type was {needs_compile_type:?} -> full compile", event.kind);
needs_compile_type = CompileType::Full;
}
(
CompileType::None | CompileType::Incremental,
// when we have a data change event, we can do an incremental compile
- EventKind::Modify(ModifyKind::Data(_)),
+ EventKind::Modify(ModifyKind::Data(_)) |
+ // windows sends ModifyKind::Any on file content changes
+ EventKind::Modify(ModifyKind::Any),
) => {
// if we are going to compile incrementally, we need to mark the exact files
// dirty
+ log::debug!("received {:?} while needs_compile_type was {needs_compile_type:?} -> incremental compile", event.kind);
if let Ok(canonicalized_path_buf) = path_buf
.canonicalize()
.map(StrippedVerbatimPath::to_stripped_verbatim_path)
@@ -208,7 +212,6 @@ async fn async_watch(
// these are not relevant events for compilation
EventKind::Access(_)
| EventKind::Other
- | EventKind::Modify(ModifyKind::Any)
| EventKind::Modify(ModifyKind::Metadata(_))
| EventKind::Modify(ModifyKind::Other),
) => (),
@@ -217,6 +220,11 @@ async fn async_watch(
}
}
}
+
+ if needs_compile_type != CompileType::None {
+ log::debug!("doing {needs_compile_type:?}");
+ }
+
match needs_compile_type {
CompileType::Incremental => {
let timing_total = Instant::now();
@@ -316,6 +324,9 @@ pub fn start(
let mut watcher = RecommendedWatcher::new(move |res| producer.push(res), Config::default())
.expect("Could not create watcher");
+
+ log::debug!("watching {folder}");
+
watcher
.watch(folder.as_ref(), RecursiveMode::Recursive)
.expect("Could not start watcher");
From d4882b4966201c80330edcccf3060f9b288c1a1a Mon Sep 17 00:00:00 2001
From: Paul Buschmann
Date: Tue, 22 Jul 2025 09:50:13 +0200
Subject: [PATCH 2/2] chore: CHANGELOG
---
CHANGELOG.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 85ad1a9514..17f81ce6e5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -33,6 +33,7 @@
#### :bug: Bug fix
- Fix `--create-sourcedirs` generation with for a single project. https://github.com/rescript-lang/rescript/pull/7671
+- Fix rewatch not recompiling on changes under windows. https://github.com/rescript-lang/rescript/pull/7690
# 12.0.0-beta.2