Skip to content

Commit 07992cf

Browse files
committed
fix sorting issue
1 parent b316bee commit 07992cf

3 files changed

Lines changed: 9 additions & 6 deletions

File tree

‎lib/Chunk.js‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ class Chunk {
501501
this._modules.sortWith(sortByFn || sortById);
502502
}
503503

504-
sortItems() {
504+
sortItems(sortChunks) {
505505
this.sortModules();
506506
this.origins.sort((a, b) => {
507507
const aIdent = a.module.identifier();
@@ -514,8 +514,10 @@ class Chunk {
514514
if(origin.reasons)
515515
origin.reasons.sort();
516516
});
517-
this._parents.sort();
518-
this._chunks.sort();
517+
if(sortChunks) {
518+
this._parents.sort();
519+
this._chunks.sort();
520+
}
519521
}
520522

521523
toString() {

‎lib/Compilation.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1115,7 +1115,7 @@ class Compilation extends Tapable {
11151115

11161116
const chunks = this.chunks;
11171117
for(let indexChunk = 0; indexChunk < chunks.length; indexChunk++) {
1118-
chunks[indexChunk].sortItems();
1118+
chunks[indexChunk].sortItems(false);
11191119
}
11201120
}
11211121

@@ -1129,7 +1129,7 @@ class Compilation extends Tapable {
11291129

11301130
const chunks = this.chunks;
11311131
for(let indexChunk = 0; indexChunk < chunks.length; indexChunk++) {
1132-
chunks[indexChunk].sortItems();
1132+
chunks[indexChunk].sortItems(true);
11331133
}
11341134

11351135
const byMessage = (a, b) => {

‎lib/util/SortableSet.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,10 @@ module.exports = class SortableSet extends Set {
4343
const sortedArray = Array.from(this).sort(sortFn);
4444
super.clear();
4545
for(let i = 0; i < sortedArray.length; i += 1) {
46-
this.add(sortedArray[i]);
46+
super.add(sortedArray[i]);
4747
}
4848
this._lastActiveSortFn = sortFn;
49+
this._frozenArray = null;
4950
}
5051

5152
/**

0 commit comments

Comments
 (0)