[Bug]: On Windows, `vp run dev` restarts the server repeatedly because watched `node_modules` folders report access as changes

Aperta
#34,217 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
56/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
node.js, typescript
Ambito
devtools, testing

Direzione di ricerca

Start by reading the dev script configuration and the change from #21065 that added --watch-path=../../packages; then inspect how the watcher treats packages/*/node_modules on Windows and Linux. Reproduce with vp run dev on Windows and check that startup reaches Listening on without restarting for access-time events. Verify Linux still does not watch loaded files under node_modules/.pnpm.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Area

apps/server, Build, CI, or release tooling

Steps to reproduce
  1. On Windows, run vp run dev from a clean checkout of main.
  2. Watch the server output before the first Listening on line.

The server restarts several times during startup, each time for a directory under packages/*/node_modules that nothing wrote to:

Change detected in 'D:\\Projects\\t3code\\packages\\source-control-gitlab\\node_modules\\@t3tools'
Restarting 'src/bin.ts'
Change detected in 'D:\\Projects\\t3code\\packages\\shared\\node_modules\\@t3tools'
Restarting 'src/bin.ts'
Change detected in 'D:\\Projects\\t3code\\packages\\provider-core\\node_modules\\@t3tools'
Restarting 'src/bin.ts'
... 9 restarts in total

It can also restart later with nothing changed, which drops the browser's connection ("is reconnecting").

Expected behavior

The dev server starts once and restarts only when a watched source file changes.

Actual behavior

Since #21065 the server runs with --watch-path=../../packages, so Node's recursive watcher also covers every packages/*/node_modules directory. None of the reported directories were modified.

I ran a separate recursive fs.watch on packages/ during one vp run dev startup. It logged 32 events, all change on packages/*/node_modules directories (mostly the @t3tools scope). For each one, mtime and ctime were about 2 hours old (clone time) and atime was under 1 second old. So these look like NTFS last-access updates from the server resolving imports through those directories, reported by Windows as changes. Each restarted server appears to touch more of them, which triggers the next restart. git status was clean throughout.

A fix would need to keep #21065's Linux behavior: not watching loaded files under node_modules/.pnpm.

Impact

Frequent failure

Version or commit

Tested on main at 4f0b74e190. The dev script is unchanged on main at 5badea5b45.

Environment

Windows 11 build 26300 x64, NTFS (fsutil behavior query disablelastaccess → 2, System Managed, last-access updates enabled), Node 26.12.1 from vp, vp 1.5.0.

Logs or stack traces

Two startups: 4 restarts before the first Listening on, then 9 restarts and 51 s from vp run dev to Listening on. In the first run, a later Change detected in '...\\packages\\secret-provider-core\\tsconfig.json' (unmodified, mtime from clone time) restarted a running server and the open page showed "reconnecting".

Lingua principale
TypeScript
Stelle
24.8k
Fork
6.4k
Merge medio
10h 56m
PR unite (30g)
226

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di pingdotgg/t3code

Tutte le issue di pingdotgg/t3code

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.