Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix webpack 3 and 4 performance regressions #259

Merged
merged 1 commit into from
Jan 31, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions lib/hard-normal-module-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ const serialNormalModule4 = serial.serial('NormalModule', {
buildMeta: serial.identity,
buildInfo: serial.created({
assets: serial.moduleAssets,
cacheable: serial.identity,
fileDependencies: serial.pathSet,
contextDependencies: serial.pathSet,
harmonyModule: serial.identity,
Expand Down Expand Up @@ -233,10 +234,11 @@ const serialNormalModule3 = serial.serial('NormalModule', {
build: serial.assigned({
built: serial.identity,
buildTimestamp: serial.identity,
cacheable: serial.identity,
meta: serial.identity,
assets: serial.moduleAssets,
fileDependencies: serial.pathSet,
contextDependencies: serial.pathSet,
fileDependencies: serial.pathArray,
contextDependencies: serial.pathArray,
harmonyModule: serial.identity,
strict: serial.identity,
exportsArgument: serial.identity,
Expand All @@ -245,6 +247,13 @@ const serialNormalModule3 = serial.serial('NormalModule', {
_source: serial.source,
}),

hash: ({
freeze(arg, module, extra, methods) {
return module.getHashDigest(extra.compilation.dependencyTemplates);
},
thaw(arg) {return arg;},
}),

dependencyBlock: serial.dependencyBlock,

setError: ({
Expand Down Expand Up @@ -286,7 +295,7 @@ const needRebuild3 = function() {
return true;
}
}
for (const dir of this.fileDependencies) {
for (const dir of this.contextDependencies) {
if (!cachedHashes[dir] || fileHashes[dir] !== cachedHashes[dir]) {
this.cacheItem.invalid = true;
this.cacheItem.invalidReason = 'md5 mismatch';
Expand Down Expand Up @@ -366,9 +375,10 @@ HardNormalModulePlugin.prototype.apply = function(compiler) {
module instanceof NormalModule &&
(
!frozen ||
schema === 4 &&
module.getHashDigest(extra.compilation.dependencyTemplates) !== frozen.source._cachedSourceHash ||
module.getHashDigest(extra.compilation.dependencyTemplates) !== frozen.source._cachedSource.hash
schema >= 4 &&
module.hash !== frozen.build.hash ||
schema < 4 &&
module.getHashDigest(extra.compilation.dependencyTemplates) !== frozen.hash
)
) {
var compilation = extra.compilation;
Expand Down