GeezerVison is showing github.com — Merge pull request #8440 from Connormiha/oprimize-chunk-can-be-integr… · webpack/webpack@72a8a1f
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: lib/Chunk.js +9-6Lines changed: 9 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -454,6 +454,10 @@ class Chunk { |
454 | 454 | } |
455 | 455 |
|
456 | 456 | canBeIntegrated(otherChunk) { |
| 457 | + if (this.preventIntegration || otherChunk.preventIntegration) { |
| 458 | + return false; |
| 459 | + } |
| 460 | + |
457 | 461 | const isAvailable = (a, b) => { |
458 | 462 | const queue = new Set(b.groupsIterable); |
459 | 463 | for (const chunkGroup of queue) { |
@@ -466,14 +470,13 @@ class Chunk { |
466 | 470 | return true; |
467 | 471 | }; |
468 | 472 |
|
469 | | - if (this.preventIntegration || otherChunk.preventIntegration) { |
470 | | - return false; |
471 | | - } |
| 473 | + const selfHasRuntime = this.hasRuntime(); |
| 474 | + const otherChunkHasRuntime = otherChunk.hasRuntime(); |
472 | 475 |
|
473 | | - if (this.hasRuntime() !== otherChunk.hasRuntime()) { |
474 | | - if (this.hasRuntime()) { |
| 476 | + if (selfHasRuntime !== otherChunkHasRuntime) { |
| 477 | + if (selfHasRuntime) { |
475 | 478 | return isAvailable(this, otherChunk); |
476 | | - } else if (otherChunk.hasRuntime()) { |
| 479 | + } else if (otherChunkHasRuntime) { |
477 | 480 | return isAvailable(otherChunk, this); |
478 | 481 | } else { |
479 | 482 | return false; |
|