make dependency order stable

This commit is contained in:
Tobias Koppers 2018-10-19 12:19:00 +02:00
parent 8a8111b637
commit 98b482efd7
2 changed files with 917 additions and 907 deletions

View File

@ -645,7 +645,15 @@ class Compilation extends Tapable {
war.dependencies = dependencies;
this.warnings.push(war);
}
module.dependencies.sort((a, b) => compareLocations(a.loc, b.loc));
const originalMap = module.dependencies.reduce((map, v, i) => {
map.set(v, i);
return map;
}, new Map());
module.dependencies.sort((a, b) => {
const cmp = compareLocations(a.loc, b.loc);
if (cmp) return cmp;
return originalMap.get(a) - originalMap.get(b);
});
if (error) {
this.hooks.failedModule.call(module, error);
return callback(error);
@ -2127,6 +2135,8 @@ class Compilation extends Tapable {
for (let indexChunk = 0; indexChunk < chunks.length; indexChunk++) {
chunks[indexChunk].sortItems();
}
chunks.sort((a, b) => a.compareTo(b));
}
sortItemsWithChunkIds() {

File diff suppressed because it is too large Load Diff