bugfix: candiates should only be added when adding was successful

This commit is contained in:
Tobias Koppers 2019-12-17 11:24:23 +01:00
parent fa57ed946c
commit 33d9f7bdbf
1 changed files with 6 additions and 1 deletions

View File

@ -315,12 +315,13 @@ class ModuleConcatenationPlugin {
// _tryToAdd modifies the config even if it fails
// so make sure to only accept changes when it succeed
const backup = currentConfiguration.snapshot();
const impCandiates = new Set();
const problem = this._tryToAdd(
compilation,
currentConfiguration,
imp,
possibleInners,
candidates,
impCandiates,
failureCache
);
if (problem) {
@ -329,6 +330,10 @@ class ModuleConcatenationPlugin {
// roll back
currentConfiguration.rollback(backup);
} else {
for (const c of impCandiates) {
candidates.add(c);
}
}
}
if (!currentConfiguration.isEmpty()) {