mirror of https://github.com/webpack/webpack.git
				
				
				
			make dependency order stable
This commit is contained in:
		
							parent
							
								
									8a8111b637
								
							
						
					
					
						commit
						98b482efd7
					
				|  | @ -645,7 +645,15 @@ class Compilation extends Tapable { | ||||||
| 					war.dependencies = dependencies; | 					war.dependencies = dependencies; | ||||||
| 					this.warnings.push(war); | 					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) { | 				if (error) { | ||||||
| 					this.hooks.failedModule.call(module, error); | 					this.hooks.failedModule.call(module, error); | ||||||
| 					return callback(error); | 					return callback(error); | ||||||
|  | @ -2127,6 +2135,8 @@ class Compilation extends Tapable { | ||||||
| 		for (let indexChunk = 0; indexChunk < chunks.length; indexChunk++) { | 		for (let indexChunk = 0; indexChunk < chunks.length; indexChunk++) { | ||||||
| 			chunks[indexChunk].sortItems(); | 			chunks[indexChunk].sortItems(); | ||||||
| 		} | 		} | ||||||
|  | 
 | ||||||
|  | 		chunks.sort((a, b) => a.compareTo(b)); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	sortItemsWithChunkIds() { | 	sortItemsWithChunkIds() { | ||||||
|  |  | ||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
		Loading…
	
		Reference in New Issue