nodejs / nodejs/node

--watch should monitor replaced files

Offen
#51,621 12 Kommentare 16 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

feature request watch-mode
Vorherrschende Sprache
JavaScript
Sterne
122k
Forks
37.3k
Ø Merge
4 T. 2 Std.
Gemergte PRs (30 T.)
283

Beschreibung

What is the problem this feature will solve?

Currently, --watch watches 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 watch mode, 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 --watch behavior 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 watch feature.

Docker Compose Issue: [BUG] Compose Watch With “node –watch” Only Reloads First Time
Docker Issue: node --watch doesn't work well within a container

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit der Node.js --watch-Implementierung und dem im Issue beschriebenen fs.watch-Verhalten. Reproduziere die Delete-and-recreate-Sequenz im Docker-Compose-Stil und bestimme anschließend, ob das bestehende Verhalten erweitert oder über ein neues Flag verfügbar gemacht werden sollte. Als erledigt gilt, wenn --watch zuverlässig reagiert, wenn eine überwachte Datei ersetzt wird, mit Testabdeckung für den Ersetzungsfall.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
javascript, nodejs
Bereich
tooling
Issue-Typ
Feature
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Aktiv
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
42/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.