-
-
Notifications
You must be signed in to change notification settings - Fork 35.7k
--watch should monitor replaced files #51621
Copy link
Copy link
Open
Labels
feature requestIssues that request new features to be added to Node.js.Issues that request new features to be added to Node.js.watch-modeIssues and PRs related to watch modeIssues and PRs related to watch mode
Metadata
Metadata
Assignees
Labels
feature requestIssues that request new features to be added to Node.js.Issues that request new features to be added to Node.js.watch-modeIssues and PRs related to watch modeIssues and PRs related to watch mode
Type
Fields
Give feedbackNo fields configured for issues without a type.
Projects
StatusShow more project fields
Awaiting Triage
What is the problem this feature will solve?
Currently,
--watchwatches an inode and not necessarily what the user might consider a "file". This can cause confusion on systems that write to disk by deleting the old file and then creating a new one.For example, when using Docker Compose's
watchmode, the watched file is first deleted. When a new file is created Node currently fails to restart on file changes, as node is still watching the inode of the deleted file, and doesn't react to the new file being created.What is the feature you are proposing to solve the problem?
While this behavior makes sense for the lower-level and more "raw"
fs.watch(), perhaps the more general--watchbehavior can be expanded to be smarter about detecting replaced files. Alternatively, a new flag can be introduced with this behavior.What alternatives have you considered?
Other alternatives require using one of the different file watcher libs. That seems like a step down from the otherwise awesome native
watchfeature.Docker Compose Issue: [BUG] Compose Watch With “node –watch” Only Reloads First Time
Docker Issue: node --watch doesn't work well within a container