fix(loader-server): a watch restart reuses the file list from startup

Aperta Adatta ai principianti
#134 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à
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
bun, typescript
Ambito
backend

Direzione di ricerca

Leggi apps/server/src/server.ts, in particolare la configurazione intorno a startWatch e runWorker nelle righe collegate. Controlla come vengono calcolati l’elenco dei file della cartella di build e il percorso di main.js, poi segui come un riavvio del watcher li passa al worker. Il lavoro è completato quando ogni riavvio usa i file correnti e l’assenza di main.js non provoca l’arresto anomalo del watcher.

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

Descrizione

app:server bug
Which app is this bug report for?

server

Issue description

In watch mode, getFiles(dir) and mainPath are computed once, before startWatch (server.ts#L31-L38). runWorker reuses that same paths array on every restart (server.ts#L42-L55).

Files added after startup are missing from the files map passed to main(), and deleted files are still in it. A game that loads a new asset fails until nf start is restarted by hand.

Found by reading the code path (not reproduced).

Expected: each restart gives the worker the current files of the build folder.

Suggested fix: compute paths and mainPath inside runWorker, and handle a missing main.js there without crashing the watcher.

Found during a read-only audit of main @ 044c766 (2026-11-11).

Code sample
const paths = getFiles(dir).filter(...);   // computed once
const runWorker = async () => {
  child = fork(..., [mainPath as string, JSON.stringify(paths)]);
};
if (watch) startWatch(dir, runWorker);     // every restart reuses the same paths
Versions
  • @nanoforge-dev/loader-client / @nanoforge-dev/loader-server / @nanoforge-dev/loader-website 1.7.0 (main @ 044c766)
  • Bun 1.3.14
  • Linux x86_64
Issue priority

Medium (should be fixed soon)

I have tested this issue on a development release

044c766

Lingua principale
TypeScript
Stelle
1
Fork
0
Merge medio
17h 25m
PR unite (30g)
11

Preparare l'ambiente

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 NanoForge-dev/Loader

Tutte le issue di NanoForge-dev/Loader

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.