| 
									
										
										
										
											2016-08-17 18:05:29 +08:00
										 |  |  | /* | 
					
						
							|  |  |  | 	MIT License http://www.opensource.org/licenses/mit-license.php
 | 
					
						
							|  |  |  | 	Author Tobias Koppers @sokra | 
					
						
							|  |  |  | */ | 
					
						
							|  |  |  | var path = require("path"); | 
					
						
							|  |  |  | var async = require("async"); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-17 18:52:02 +08:00
										 |  |  | function FlagInitialModulesAsUsedPlugin() {} | 
					
						
							| 
									
										
										
										
											2016-08-17 18:05:29 +08:00
										 |  |  | module.exports = FlagInitialModulesAsUsedPlugin; | 
					
						
							|  |  |  | FlagInitialModulesAsUsedPlugin.prototype.apply = function(compiler) { | 
					
						
							|  |  |  | 	compiler.plugin("compilation", function(compilation) { | 
					
						
							|  |  |  | 		compilation.plugin("after-optimize-chunks", function(chunks) { | 
					
						
							|  |  |  | 			chunks.forEach(function(chunk) { | 
					
						
							|  |  |  | 				if(!chunk.isInitial()) { | 
					
						
							|  |  |  | 					return; | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 				chunk.modules.forEach(function(module) { | 
					
						
							|  |  |  | 					module.usedExports = true; | 
					
						
							|  |  |  | 				}); | 
					
						
							|  |  |  | 			}); | 
					
						
							|  |  |  | 		}); | 
					
						
							|  |  |  | 	}); | 
					
						
							|  |  |  | }; |