From 51619a8f1a75dd27d9c8e5e69ad4034a82181a3a Mon Sep 17 00:00:00 2001 From: Hai Date: Tue, 9 Sep 2025 00:52:20 +0800 Subject: [PATCH] fix: don't check context timestamp hash in watch mode --- lib/Compilation.js | 3 +++ lib/FileSystemInfo.js | 2 ++ 2 files changed, 5 insertions(+) diff --git a/lib/Compilation.js b/lib/Compilation.js index def82b382..5f3f53436 100644 --- a/lib/Compilation.js +++ b/lib/Compilation.js @@ -1042,6 +1042,9 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si logger: this.getLogger("webpack.FileSystemInfo"), hashFunction: compiler.options.output.hashFunction }); + if (compiler.watchMode) { + this.fileSystemInfo._checkContextTimestampHash = false; + } if (compiler.fileTimestamps) { this.fileSystemInfo.addFileTimestamps(compiler.fileTimestamps, true); } diff --git a/lib/FileSystemInfo.js b/lib/FileSystemInfo.js index 9f350e6ee..07c894575 100644 --- a/lib/FileSystemInfo.js +++ b/lib/FileSystemInfo.js @@ -1248,6 +1248,7 @@ class FileSystemInfo { this._cachedDeprecatedContextTimestamps = undefined; this._warnAboutExperimentalEsmTracking = false; + this._checkContextTimestampHash = true; this._statCreatedSnapshots = 0; this._statTestedSnapshotsCached = 0; @@ -2919,6 +2920,7 @@ class FileSystemInfo { } const snap = /** @type {ResolvedContextFileSystemInfoEntry} */ (s); if ( + this._checkContextTimestampHash && snap.timestampHash !== undefined && c.timestampHash !== snap.timestampHash ) {