mirror of https://github.com/webpack/webpack.git
				
				
				
			Merge pull request #8592 from hulkish/hoist-plugin-logic
perf: hoist option logic, reduce code paths in handler
This commit is contained in:
		
						commit
						b133ebeb25
					
				|  | @ -23,6 +23,10 @@ class NodeTemplatePlugin { | |||
| 	 * @returns {void} | ||||
| 	 */ | ||||
| 	apply(compiler) { | ||||
| 		const ChunkLoadingRuntimeModule = this.asyncChunkLoading | ||||
| 			? ReadFileChunkLoadingRuntimeModule | ||||
| 			: RequireChunkLoadingRuntimeModule; | ||||
| 
 | ||||
| 		compiler.hooks.thisCompilation.tap("NodeTemplatePlugin", compilation => { | ||||
| 			new NodeChunkTemplatePlugin(compilation).apply(compilation.chunkTemplate); | ||||
| 
 | ||||
|  | @ -31,17 +35,10 @@ class NodeTemplatePlugin { | |||
| 				if (onceForChunkSet.has(chunk)) return; | ||||
| 				onceForChunkSet.add(chunk); | ||||
| 				set.add(RuntimeGlobals.moduleFactories); | ||||
| 				if (this.asyncChunkLoading) { | ||||
| 					compilation.addRuntimeModule( | ||||
| 						chunk, | ||||
| 						new ReadFileChunkLoadingRuntimeModule(chunk, set) | ||||
| 					); | ||||
| 				} else { | ||||
| 					compilation.addRuntimeModule( | ||||
| 						chunk, | ||||
| 						new RequireChunkLoadingRuntimeModule(chunk, set) | ||||
| 					); | ||||
| 				} | ||||
| 				compilation.addRuntimeModule( | ||||
| 					chunk, | ||||
| 					new ChunkLoadingRuntimeModule(chunk, set) | ||||
| 				); | ||||
| 			}; | ||||
| 
 | ||||
| 			compilation.hooks.runtimeRequirementInTree | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue