| 
									
										
										
										
											2014-03-05 16:58:51 +08:00
										 |  |  | /* | 
					
						
							|  |  |  | 	MIT License http://www.opensource.org/licenses/mit-license.php
 | 
					
						
							|  |  |  | 	Author Tobias Koppers @sokra | 
					
						
							|  |  |  | */ | 
					
						
							| 
									
										
										
										
											2016-12-29 15:08:46 +08:00
										 |  |  | "use strict"; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-15 16:28:45 +08:00
										 |  |  | const ExternalModuleFactoryPlugin = require("./ExternalModuleFactoryPlugin"); | 
					
						
							| 
									
										
										
										
											2014-03-05 16:58:51 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-12-29 15:08:46 +08:00
										 |  |  | class ExternalsPlugin { | 
					
						
							|  |  |  | 	constructor(type, externals) { | 
					
						
							|  |  |  | 		this.type = type; | 
					
						
							|  |  |  | 		this.externals = externals; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	apply(compiler) { | 
					
						
							| 
									
										
										
										
											2018-02-25 09:00:20 +08:00
										 |  |  | 		compiler.hooks.compile.tap("ExternalsPlugin", ({ normalModuleFactory }) => { | 
					
						
							|  |  |  | 			new ExternalModuleFactoryPlugin(this.type, this.externals).apply( | 
					
						
							|  |  |  | 				normalModuleFactory | 
					
						
							|  |  |  | 			); | 
					
						
							| 
									
										
										
										
											2016-12-29 15:08:46 +08:00
										 |  |  | 		}); | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2014-03-05 16:58:51 +08:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2016-12-29 15:08:46 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-03-05 16:58:51 +08:00
										 |  |  | module.exports = ExternalsPlugin; |