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

Ouverte
#34,217 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
4/5
Temps estimé
3-5 jours
Accessibilité débutants
56/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
Active
Stack technique
node.js, typescript
Domaine
devtools, testing

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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".

Langage dominant
TypeScript
Étoiles
24.8k
Forks
6.4k
Merge moyen
10 h 56 min
PR mergées (30 j)
226

Préparer son environnement

Ouvrir dans Codespaces

Lance le conteneur de développement du projet dans votre navigateur, avec votre propre compte GitHub.

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de pingdotgg/t3code

Toutes les issues de pingdotgg/t3code

Issues similaires

Plus d'issues TypeScript

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.