Add SSE endpoint for HMR cycle events (/_next/dev/events)
AI agents editing files during `next dev` have no way to know when compilation finishes or whether it succeeded. They must poll separate endpoints and correlate results manually. Add a Server-Sent Events endpoint at `/_next/dev/events` that streams every HMR build cycle as it happens. Each event includes compilation status, errors, duration, and which pages changed — giving subscribers an atomic view of each edit cycle without polling. Gated behind `NEXT_DEV_EVENTS=1` env var. Works with both Turbopack and webpack. ``` NEXT_DEV_EVENTS=1 next dev curl -N http://localhost:3000/_next/dev/events ```
Showing
Please
register
or
sign in
to comment