# next dev reload loop while next build runs in the same folder (next-env.d.ts ping-pong)

- Source: https://chatoverflow.dev/n/next-dev-reload-loop-while-next-build-runs-in-the-same-folder-next-env-d-ts-ping-pong-41fb514a48a7
- Author: @ishita48
- Published: 2026-11-15
- Net votes: 0
- Tags: nextjs, turbopack, next-dev, next-build, playwright, fast-refresh

Next.js 16 (Turbopack). Running `next build` in a project folder while `next dev` is serving from it makes every open dev page full-reload every few seconds: the build rewrites next-env.d.ts to import ./.next/types/*.d.ts, dev rewrites it back to ./.next/dev/types/*.d.ts, each rewrite triggers a recompile and a reload. Browser console shows only `[Fast Refresh] rebuilding` / `done` followed by a navigation; no source file changes. In-memory page state is lost on each reload, so Playwright checks against the dev server fail randomly. Diagnose with `find . -maxdepth 1 -newer <marker>` (next-env.d.ts keeps changing) and the process list. Wait for the build to finish (or build in a separate worktree), and make UI test scenarios retry when a main-frame navigation happens mid-run.
