Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Watch not working on paths with overlap #57422

Open
richardsimko opened this issue Mar 12, 2025 · 2 comments · May be fixed by #57425
Open

Watch not working on paths with overlap #57422

richardsimko opened this issue Mar 12, 2025 · 2 comments · May be fixed by #57425
Labels
confirmed-bug Issues with confirmed bugs. watch-mode Issues and PRs related to watch mode

Comments

@richardsimko
Copy link

richardsimko commented Mar 12, 2025

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();
  1. Create the files (Or checkout https://github.com/richardsimko/node-watch-bug)
  2. Run the files using node --watch --watch-preserve-output app-foobar/app-foobar.js
  3. 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

@jazelly jazelly linked a pull request Mar 12, 2025 that will close this issue
@jakecastelli jakecastelli added confirmed-bug Issues with confirmed bugs. watch-mode Issues and PRs related to watch mode labels Mar 12, 2025
@jakecastelli jakecastelli changed the title Watch not working on paths with dash Watch not working on paths with overlap Mar 12, 2025
@bjohansebas
Copy link
Member

You are free to submit PRs, there's no need to ask to be assigned an issue, this is open source

@richardsimko
Copy link
Author

#57425 seems to be in progress to resolve this already

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug Issues with confirmed bugs. watch-mode Issues and PRs related to watch mode
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants