| 
									
										
										
										
											2017-09-25 19:28:29 +08:00
										 |  |  | "use strict"; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class ContextExclusionPlugin { | 
					
						
							|  |  |  | 	constructor(negativeMatcher) { | 
					
						
							|  |  |  | 		this.negativeMatcher = negativeMatcher; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	apply(compiler) { | 
					
						
							| 
									
										
										
										
											2017-12-06 22:01:25 +08:00
										 |  |  | 		compiler.hooks.contextModuleFactory.tap("ContextExclusionPlugin", (cmf) => { | 
					
						
							| 
									
										
										
										
											2017-12-14 04:35:39 +08:00
										 |  |  | 			cmf.hooks.contextModuleFiles.tap("ContextExclusionPlugin", (files) => { | 
					
						
							| 
									
										
										
										
											2017-09-25 19:28:29 +08:00
										 |  |  | 				return files.filter(filePath => !this.negativeMatcher.test(filePath)); | 
					
						
							|  |  |  | 			}); | 
					
						
							|  |  |  | 		}); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | module.exports = ContextExclusionPlugin; |