Closed
Description
Version
v23.9.0
Platform
Darwin Mac 24.3.0 Darwin Kernel Version 24.3.0: Thu Jan 2 20:24:22 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T6041 arm64
Subsystem
--watch
What steps will reproduce the bug?
app-foobar/app-foobar.js
This is the entrypoint:
import { Server } from "http";
import { test2 } from "../app/test.js";
const port = process.env.PORT || "5002";
async function init() {
console.log(test2);
// Server just to keep the process alive
const server = new Server();
server.listen(port);
server.on("listening", () =>
console.info("Server listening on port " + port)
);
}
void init();
app/test.js
export class Test {
constructor() {
console.log("Test");
}
}
export const test2 = new Test();
- Create the files (Or checkout https://github.com/richardsimko/node-watch-bug)
- Run the files using
node --watch --watch-preserve-output app-foobar/app-foobar.js
- Make a change to
app-foobar/app-foobar.js
A complete repo with everything set up to test: https://github.com/richardsimko/node-watch-bug
How often does it reproduce? Is there a required condition?
It happens every time a path "overlaps" with another, for example:
foo/
and foo-bar/
app/
and app-foo/
What is the expected behavior? Why is that the expected behavior?
The watcher works for all files imported.
What do you see instead?
The watcher doesn't work for files which have an overlap with other files, in the example, changes to app-foobar/app-foobar.js
don't trigger a restart but changes to app/test.js
does.
Additional information
No response