diff --git a/lib/listening.js b/lib/listening.js index 3b68262..b6762fe 100644 --- a/lib/listening.js +++ b/lib/listening.js @@ -36,9 +36,6 @@ const restartServer = (file, flags, watcher) => { } } - // Stop watching any files - watcher.close() - // Remove file that changed from the `require` cache for (const item of toDelete) { let location @@ -102,7 +99,7 @@ module.exports = async (server, inUse, flags, sockets) => { const watcher = watch(toWatch, watchConfig) // Ensure that the server gets restarted if a file changes - watcher.on( + watcher.once( 'all', debounce((event, filePath) => { const location = path.relative(process.cwd(), filePath)