| 
									
										
										
										
											2016-08-17 18:05:29 +08:00
										 |  |  | /* | 
					
						
							|  |  |  | 	MIT License http://www.opensource.org/licenses/mit-license.php
 | 
					
						
							|  |  |  | 	Author Tobias Koppers @sokra | 
					
						
							|  |  |  | */ | 
					
						
							| 
									
										
										
										
											2017-01-12 00:08:13 +08:00
										 |  |  | "use strict"; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class FlagInitialModulesAsUsedPlugin { | 
					
						
							|  |  |  | 	apply(compiler) { | 
					
						
							|  |  |  | 		compiler.plugin("compilation", (compilation) => { | 
					
						
							|  |  |  | 			compilation.plugin("after-optimize-chunks", (chunks) => { | 
					
						
							|  |  |  | 				chunks.forEach((chunk) => { | 
					
						
							|  |  |  | 					if(!chunk.isInitial()) { | 
					
						
							|  |  |  | 						return; | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 					chunk.modules.forEach((module) => { | 
					
						
							|  |  |  | 						module.usedExports = true; | 
					
						
							|  |  |  | 					}); | 
					
						
							| 
									
										
										
										
											2016-08-17 18:05:29 +08:00
										 |  |  | 				}); | 
					
						
							|  |  |  | 			}); | 
					
						
							|  |  |  | 		}); | 
					
						
							| 
									
										
										
										
											2017-01-12 00:08:13 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | module.exports = FlagInitialModulesAsUsedPlugin; |