mirror of https://github.com/webpack/webpack.git
Merge pull request #14413 from webpack/bugfix/cache-unaffected
bugfix cacheUnaffected
This commit is contained in:
commit
48c3d290c5
|
|
@ -2252,7 +2252,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|||
}
|
||||
|
||||
for (const module of modulesWithoutCache) {
|
||||
const buildInfo = module.buildInfo && module.buildInfo.buildInfo;
|
||||
const buildInfo = module.buildInfo;
|
||||
if (buildInfo) {
|
||||
// create a new entry
|
||||
const memCache = new WeakTupleMap();
|
||||
|
|
@ -2340,6 +2340,9 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|||
const moduleMemCaches2 = (this.moduleMemCaches2 = new Map());
|
||||
const { moduleGraph, chunkGraph } = this;
|
||||
const key = "memCache2";
|
||||
let statUnchanged = 0;
|
||||
let statChanged = 0;
|
||||
let statNew = 0;
|
||||
/**
|
||||
* @param {Module} module module
|
||||
* @returns {{ modules?: Map<Module, string | number | undefined>, blocks?: (string | number)[] }} references
|
||||
|
|
@ -2354,7 +2357,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|||
for (const m of outgoing.keys()) {
|
||||
if (!m) continue;
|
||||
if (modules === undefined) modules = new Map();
|
||||
modules.set(m, chunkGraph.getModuleId(module));
|
||||
modules.set(m, chunkGraph.getModuleId(m));
|
||||
}
|
||||
}
|
||||
if (module.blocks.length > 0) {
|
||||
|
|
@ -2416,15 +2419,24 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|||
memCache: memCache2
|
||||
});
|
||||
moduleMemCaches2.set(module, memCache2);
|
||||
statNew++;
|
||||
} else if (!compareReferences(module, cache.references)) {
|
||||
const memCache = new WeakTupleMap();
|
||||
cache.references = computeReferences(module);
|
||||
cache.memCache = memCache;
|
||||
moduleMemCaches2.set(module, memCache);
|
||||
statChanged++;
|
||||
} else {
|
||||
moduleMemCaches2.set(module, cache.memCache);
|
||||
statUnchanged++;
|
||||
}
|
||||
}
|
||||
|
||||
this.logger.log(
|
||||
`${Math.round(
|
||||
(100 * statChanged) / (statNew + statChanged + statUnchanged)
|
||||
)}% modules flagged as affected by chunk graph (${statNew} new modules, ${statChanged} changed, ${statUnchanged} unchanged)`
|
||||
);
|
||||
}
|
||||
|
||||
finish(callback) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue