fix build cycle detection in Compilation

When tracking the modules which are being built by an origin module,
the code mistakenly adds the origin module itself to the set of modules
it's building, instead of the actual module about to be built. As a
result, when a module build finishes (and the module has itself called
loadModule()), it remains marked as building itself. So if it gets
loaded again, a BuildCycleError is reported despite no cycle existing.

Fixes #14379
This commit is contained in:
Hal Blackburn 2021-10-18 20:20:23 +01:00
parent 1484aecf4c
commit 8f2c266966
1 changed files with 1 additions and 1 deletions

View File

@ -1883,7 +1883,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
creatingModuleDuringBuildSet
);
}
creatingModuleDuringBuildSet.add(originModule);
creatingModuleDuringBuildSet.add(module);
// When building is blocked by another module
// search for a cycle, cancel the cycle by throwing