diff --git a/lib/internal/watch_mode/files_watcher.js b/lib/internal/watch_mode/files_watcher.js index 895c6ec138d131..51b09c840b65f4 100644 --- a/lib/internal/watch_mode/files_watcher.js +++ b/lib/internal/watch_mode/files_watcher.js @@ -98,7 +98,7 @@ class FilesWatcher extends EventEmitter { } const watcher = watch(path, { recursive, signal: this.#signal }); watcher.on('change', (eventType, fileName) => this - .#onChange(recursive ? resolve(path, fileName) : path)); + .#onChange(recursive ? resolve(path, fileName ?? '') : path)); this.#watchers.set(path, { handle: watcher, recursive }); if (recursive) { this.#removeWatchedChildren(path);