diff --git a/lib/Chunk.js b/lib/Chunk.js index a0a3397d6d2..b7811c5b516 100644 --- a/lib/Chunk.js +++ b/lib/Chunk.js @@ -454,6 +454,10 @@ class Chunk { } canBeIntegrated(otherChunk) { + if (this.preventIntegration || otherChunk.preventIntegration) { + return false; + } + const isAvailable = (a, b) => { const queue = new Set(b.groupsIterable); for (const chunkGroup of queue) { @@ -466,14 +470,13 @@ class Chunk { return true; }; - if (this.preventIntegration || otherChunk.preventIntegration) { - return false; - } + const selfHasRuntime = this.hasRuntime(); + const otherChunkHasRuntime = otherChunk.hasRuntime(); - if (this.hasRuntime() !== otherChunk.hasRuntime()) { - if (this.hasRuntime()) { + if (selfHasRuntime !== otherChunkHasRuntime) { + if (selfHasRuntime) { return isAvailable(this, otherChunk); - } else if (otherChunk.hasRuntime()) { + } else if (otherChunkHasRuntime) { return isAvailable(otherChunk, this); } else { return false;