fix: use marker file for .next deletion detection
The polling approach checked existsSync on the distDir, but: 1. In dev mode, config.distDir is .next/dev, not .next 2. Bundlers (webpack/turbopack) recreate the directory structure almost immediately after deletion, making the check always pass Write a marker file (server-marker) inside the distDir at server start. Poll for its existence instead - when .next is deleted, the marker file disappears and is never recreated by the bundler, reliably detecting the deletion. Also reduce poll interval from 2s to 500ms for faster detection.
Showing
Please
register
or
sign in
to comment