From 4124fcd6f0203533ab8dece9fc1990a752650d4f Mon Sep 17 00:00:00 2001 From: Aleksandr Kukhta Date: Tue, 25 Oct 2022 16:34:54 +0300 Subject: [PATCH] fix: support new webpack watcher API (#738) --- src/VirtualModulePlugin.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/VirtualModulePlugin.ts b/src/VirtualModulePlugin.ts index a2ad8375..829fff11 100644 --- a/src/VirtualModulePlugin.ts +++ b/src/VirtualModulePlugin.ts @@ -167,10 +167,14 @@ class VirtualModulesPlugin { : finalWatchFileSystem.watcher.fileWatchers; fileWatchers.forEach((fileWatcher) => { - if (fileWatcher.path === filePath) { + const fileWatcherPath = fileWatcher.path || fileWatcher.watcher.path; + + if (fileWatcherPath === filePath) { + const fileWatcherDirectoryWatcher = fileWatcher.directoryWatcher || fileWatcher.watcher.directoryWatcher; + debug(this.compiler.name, 'Emit file change:', filePath, time); - // delete fileWatcher.directoryWatcher._cachedTimeInfoEntries; - fileWatcher.directoryWatcher.setFileTime( + // delete fileWatcherDirectoryWatcher._cachedTimeInfoEntries; + fileWatcherDirectoryWatcher.setFileTime( filePath, time, false,