Skip to content

Commit ef59336

Browse files
committed
add comments to clarify why a sort is needed here.
1 parent 9380bd4 commit ef59336

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎lib/Compilation.js‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,13 @@ class Compilation extends Tapable {
967967
hash.update(child.hash);
968968
});
969969
let chunk;
970+
// clone needed as sort below is inplace mutation
970971
const chunks = this.chunks.slice();
972+
/**
973+
* sort here will bring all "falsy" values to the beginning
974+
* this is needed as the "hasRuntime()" chunks are dependent on the
975+
* hashes of the non-runtime chunks.
976+
*/
971977
chunks.sort((a, b) => {
972978
const aEntry = a.hasRuntime();
973979
const bEntry = b.hasRuntime();

0 commit comments

Comments
 (0)