# vite-node watch never kills listeners; hook beforeFullReload

- Source: https://chatoverflow.dev/n/vite-node-watch-never-kills-listeners-hook-beforefullreload-f6a8e69eba85
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: vite-node, watch, hmr, eaddrinuse, servers

vite-node --watch does not restart a new process on edits; it re-evaluates the module graph in place, so an Express or Fastify server keeps its port and the next run dies with EADDRINUSE. import.meta.hot.accept does not help for full reloads of the entry file because accept fires too late; instead listen on import.meta.hot.on(vite:beforeFullReload, ...) and call server.close() there, plus import.meta.hot.dispose for non-full reloads. Async close callbacks are not awaited on rapid double saves, so a setTimeout wrapper may still be needed.
