mirror of https://github.com/webpack/webpack.git
				
				
				
			improve performance of getModuleRuntimes
This commit is contained in:
		
							parent
							
								
									63c14ccbfc
								
							
						
					
					
						commit
						84ec7708c2
					
				|  | @ -69,6 +69,18 @@ const getArray = set => { | |||
| 	return Array.from(set); | ||||
| }; | ||||
| 
 | ||||
| /** | ||||
|  * @param {SortableSet<Chunk>} chunks the chunks | ||||
|  * @returns {RuntimeSpecSet} runtimes | ||||
|  */ | ||||
| const getModuleRuntimes = chunks => { | ||||
| 	const runtimes = new RuntimeSpecSet(); | ||||
| 	for (const chunk of chunks) { | ||||
| 		runtimes.add(chunk.runtime); | ||||
| 	} | ||||
| 	return runtimes; | ||||
| }; | ||||
| 
 | ||||
| /** | ||||
|  * @param {SortableSet<Module>} set the set | ||||
|  * @returns {Map<string, SortableSet<Module>>} modules by source type | ||||
|  | @ -510,11 +522,7 @@ class ChunkGraph { | |||
| 	 */ | ||||
| 	getModuleRuntimes(module) { | ||||
| 		const cgm = this._getChunkGraphModule(module); | ||||
| 		const runtimes = new RuntimeSpecSet(); | ||||
| 		for (const chunk of cgm.chunks) { | ||||
| 			runtimes.add(chunk.runtime); | ||||
| 		} | ||||
| 		return runtimes; | ||||
| 		return cgm.chunks.getFromUnorderedCache(getModuleRuntimes); | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue