From c670f73e27d3cd0ccd7d9bd823244b520c7720ff Mon Sep 17 00:00:00 2001 From: "Michael \"Z\" Goddard" Date: Sun, 22 Jul 2018 00:43:45 -0400 Subject: [PATCH] fix: performance regression due to false position md5 (#413) * fix: performance regression due to false positive md5 * fix: improve hard modules test Make sure the module used it's cached content and wasn't unbuilt and then rebuilt. --- lib/TransformNormalModulePlugin.js | 4 ++-- tests/util/index.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/TransformNormalModulePlugin.js b/lib/TransformNormalModulePlugin.js index 4559af13..1fe3d392 100644 --- a/lib/TransformNormalModulePlugin.js +++ b/lib/TransformNormalModulePlugin.js @@ -218,7 +218,7 @@ const needRebuild4 = function() { return true; } const fileHashes = this.__hardSourceFileMd5s; - const cachedHashes = this.__hardSource_oldHashes; + const cachedHashes = this.__hardSourceCachedMd5s; const resolvedLast = this.__hardSource_resolved; const missingCache = this.__hardSource_missingCache; @@ -429,7 +429,7 @@ const needRebuild3 = function() { return true; } const fileHashes = this.__hardSourceFileMd5s; - const cachedHashes = this.__hardSource_oldHashes; + const cachedHashes = this.__hardSourceCachedMd5s; const resolvedLast = this.__hardSource_resolved; const missingCache = this.__hardSource_missingCache; diff --git a/tests/util/index.js b/tests/util/index.js index ad3bebe2..9b82687b 100644 --- a/tests/util/index.js +++ b/tests/util/index.js @@ -465,7 +465,7 @@ exports.itCompilesHardModules = function(fixturePath, filesA, filesB, expectHand var shortener = new (require('webpack/lib/RequestShortener'))(path.resolve(__dirname, '../fixtures', fixturePath)); function walk(compilation) { compilation.modules.forEach(function(module) { - if (module.cacheItem) { + if (module.cacheItem && module.buildTimestamp === module.cacheItem.build.buildTimestamp) { hardModules.push(module.readableIdentifier(shortener)); } });