Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #6613 from brentwilton/improve-performance-of-modu…
…le-concatenation-plugin

improve performance of ModuleConcatenationPlugin for loop
  • Loading branch information
sokra committed Mar 3, 2018
2 parents 3c5b104 + 39095ef commit 2e687d0
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/optimize/ModuleConcatenationPlugin.js
Expand Up @@ -281,9 +281,16 @@ class ModuleConcatenationPlugin {
for (const reason of newModule.reasons) {
reason.dependency.module = newModule;
}
for (const dep of newModule.dependencies) {
// TODO: remove when LTS node version contains fixed v8 version
// @see https://github.com/webpack/webpack/pull/6613
// Turbofan does not correctly inline for-of loops with polymorphic input arrays.
// Work around issue by using a standard for loop and assigning dep.module.reasons
for (let i = 0; i < newModule.dependencies.length; i++) {
let dep = newModule.dependencies[i];
if (dep.module) {
for (const reason of dep.module.reasons) {
let reasons = dep.module.reasons;
for (let j = 0; j < reasons.length; j++) {
let reason = reasons[j];
if (reason.dependency === dep) reason.module = newModule;
}
}
Expand Down

0 comments on commit 2e687d0

Please sign in to comment.