2013-01-31 01:49:25 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								/*
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									MIT License http://www.opensource.org/licenses/mit-license.php
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									Author Tobias Koppers @sokra
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								*/
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								var OptionsApply = require("./OptionsApply");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								var FunctionModulePlugin = require("./FunctionModulePlugin");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								var EvalDevToolModulePlugin = require("./EvalDevToolModulePlugin");
							 | 
						
					
						
							
								
									
										
										
										
											2013-03-26 23:54:41 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								var SourceMapDevToolPlugin = require("./SourceMapDevToolPlugin");
							 | 
						
					
						
							
								
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								var SingleEntryPlugin = require("./SingleEntryPlugin");
							 | 
						
					
						
							
								
									
										
										
										
											2013-01-31 08:44:39 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								var MultiEntryPlugin = require("./MultiEntryPlugin");
							 | 
						
					
						
							
								
									
										
										
										
											2013-05-31 18:22:40 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								var RecordIdsPlugin = require("./RecordIdsPlugin");
							 | 
						
					
						
							
								
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								var APIPlugin = require("./APIPlugin");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								var ConstPlugin = require("./ConstPlugin");
							 | 
						
					
						
							
								
									
										
										
										
											2013-02-14 04:24:00 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								var RequireJsStuffPlugin = require("./RequireJsStuffPlugin");
							 | 
						
					
						
							
								
									
										
										
										
											2013-02-14 00:00:07 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								var NodeStuffPlugin = require("./NodeStuffPlugin");
							 | 
						
					
						
							
								
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								var CompatibilityPlugin = require("./CompatibilityPlugin");
							 | 
						
					
						
							
								
									
										
										
										
											2013-09-13 17:17:57 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								var DefinePlugin = require("./DefinePlugin");
							 | 
						
					
						
							
								
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2013-12-18 06:21:49 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								var MovedToPluginWarningPlugin = require("./MovedToPluginWarningPlugin");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2013-10-28 23:21:29 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								var LoaderPlugin = require("./dependencies/LoaderPlugin");
							 | 
						
					
						
							
								
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								var CommonJsPlugin = require("./dependencies/CommonJsPlugin");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								var AMDPlugin = require("./dependencies/AMDPlugin");
							 | 
						
					
						
							
								
									
										
										
										
											2013-02-26 19:36:34 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								var LabeledModulesPlugin = require("./dependencies/LabeledModulesPlugin");
							 | 
						
					
						
							
								
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								var RequireContextPlugin = require("./dependencies/RequireContextPlugin");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								var RequireEnsurePlugin = require("./dependencies/RequireEnsurePlugin");
							 | 
						
					
						
							
								
									
										
										
										
											2013-02-16 00:08:14 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								var RequireIncludePlugin = require("./dependencies/RequireIncludePlugin");
							 | 
						
					
						
							
								
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								var RemoveParentModulesPlugin = require("./optimize/RemoveParentModulesPlugin");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								var RemoveEmptyChunksPlugin = require("./optimize/RemoveEmptyChunksPlugin");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								var MergeDuplicateChunksPlugin = require("./optimize/MergeDuplicateChunksPlugin");
							 | 
						
					
						
							
								
									
										
										
										
											2013-02-24 09:05:55 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								var FlagIncludedChunksPlugin = require("./optimize/FlagIncludedChunksPlugin");
							 | 
						
					
						
							
								
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2013-07-04 18:01:10 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								var UnsafeCachePlugin = require("enhanced-resolve/lib/UnsafeCachePlugin");
							 | 
						
					
						
							
								
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								var ModulesInDirectoriesPlugin = require("enhanced-resolve/lib/ModulesInDirectoriesPlugin");
							 | 
						
					
						
							
								
									
										
										
										
											2013-02-04 17:47:00 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								var ModulesInRootPlugin = require("enhanced-resolve/lib/ModulesInRootPlugin");
							 | 
						
					
						
							
								
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								var ModuleTemplatesPlugin = require("enhanced-resolve/lib/ModuleTemplatesPlugin");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								var ModuleAsFilePlugin = require("enhanced-resolve/lib/ModuleAsFilePlugin");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								var ModuleAsDirectoryPlugin = require("enhanced-resolve/lib/ModuleAsDirectoryPlugin");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								var ModuleAliasPlugin = require("enhanced-resolve/lib/ModuleAliasPlugin");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								var DirectoryDefaultFilePlugin = require("enhanced-resolve/lib/DirectoryDefaultFilePlugin");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								var DirectoryDescriptionFilePlugin = require("enhanced-resolve/lib/DirectoryDescriptionFilePlugin");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								var FileAppendPlugin = require("enhanced-resolve/lib/FileAppendPlugin");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								var DirectoryResultPlugin = require("enhanced-resolve/lib/DirectoryResultPlugin");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								function WebpackOptionsApply() {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									OptionsApply.call(this);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								module.exports = WebpackOptionsApply;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								WebpackOptionsApply.prototype = Object.create(OptionsApply.prototype);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								WebpackOptionsApply.prototype.process = function(options, compiler) {
							 | 
						
					
						
							
								
									
										
										
										
											2013-12-18 06:21:49 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									compiler.context = options.context;
							 | 
						
					
						
							
								
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									if(options.plugins && Array.isArray(options.plugins)) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										compiler.apply.apply(compiler, options.plugins);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									compiler.outputPath = options.output.path;
							 | 
						
					
						
							
								
									
										
										
										
											2013-05-31 18:22:40 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									compiler.recordsInputPath = options.recordsInputPath || options.recordsPath;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									compiler.recordsOutputPath = options.recordsOutputPath || options.recordsPath;
							 | 
						
					
						
							
								
									
										
										
										
											2013-02-14 00:00:07 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									switch(options.target) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									case "web":
							 | 
						
					
						
							
								
									
										
										
										
											2013-07-11 05:20:07 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										var JsonpTemplatePlugin = require("./JsonpTemplatePlugin");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										var NodeSourcePlugin = require("./node/NodeSourcePlugin");
							 | 
						
					
						
							
								
									
										
										
										
											2013-02-14 00:00:07 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										compiler.apply(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											new JsonpTemplatePlugin(options.output),
							 | 
						
					
						
							
								
									
										
										
										
											2013-12-18 06:21:49 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											new FunctionModulePlugin(options.output),
							 | 
						
					
						
							
								
									
										
										
										
											2013-02-26 20:31:05 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											new NodeSourcePlugin(options.node)
							 | 
						
					
						
							
								
									
										
										
										
											2013-02-14 00:00:07 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										break;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									case "webworker":
							 | 
						
					
						
							
								
									
										
										
										
											2013-07-11 05:20:07 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										var WebWorkerTemplatePlugin = require("./webworker/WebWorkerTemplatePlugin");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										var NodeSourcePlugin = require("./node/NodeSourcePlugin");
							 | 
						
					
						
							
								
									
										
										
										
											2013-02-14 00:00:07 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										compiler.apply(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											new WebWorkerTemplatePlugin(options.output),
							 | 
						
					
						
							
								
									
										
										
										
											2013-12-18 06:21:49 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											new FunctionModulePlugin(options.output),
							 | 
						
					
						
							
								
									
										
										
										
											2013-02-26 20:31:05 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											new NodeSourcePlugin(options.node)
							 | 
						
					
						
							
								
									
										
										
										
											2013-02-14 00:00:07 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										break;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									case "node":
							 | 
						
					
						
							
								
									
										
										
										
											2013-12-16 06:08:11 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									case "async-node":
							 | 
						
					
						
							
								
									
										
										
										
											2013-07-11 05:20:07 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										var NodeTemplatePlugin = require("./node/NodeTemplatePlugin");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										var NodeTargetPlugin = require("./node/NodeTargetPlugin");
							 | 
						
					
						
							
								
									
										
										
										
											2013-02-14 00:00:07 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										compiler.apply(
							 | 
						
					
						
							
								
									
										
										
										
											2013-12-16 06:08:11 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											new NodeTemplatePlugin(options.output, options.target === "async-node"),
							 | 
						
					
						
							
								
									
										
										
										
											2013-12-18 06:21:49 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											new FunctionModulePlugin(options.output),
							 | 
						
					
						
							
								
									
										
										
										
											2013-02-14 00:00:07 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											new NodeTargetPlugin()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										break;
							 | 
						
					
						
							
								
									
										
										
										
											2014-02-11 15:53:32 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									default:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										throw new Error("Unsupported target '" + options.target + "'.");
							 | 
						
					
						
							
								
									
										
										
										
											2013-02-14 00:00:07 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									}
							 | 
						
					
						
							
								
									
										
										
										
											2013-06-19 17:53:03 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									if(options.output.library || options.output.libraryTarget != "var") {
							 | 
						
					
						
							
								
									
										
										
										
											2013-07-11 05:20:07 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										var LibraryTemplatePlugin = require("./LibraryTemplatePlugin");
							 | 
						
					
						
							
								
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										compiler.apply(new LibraryTemplatePlugin(options.output.library, options.output.libraryTarget));
							 | 
						
					
						
							
								
									
										
										
										
											2013-06-19 17:53:03 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2013-06-19 19:49:57 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									if(options.hot) {
							 | 
						
					
						
							
								
									
										
										
										
											2013-12-18 06:21:49 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										compiler.apply(new MovedToPluginWarningPlugin("hot", "HotModuleReplacementPlugin"));
							 | 
						
					
						
							
								
									
										
										
										
											2013-07-11 05:20:07 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										var HotModuleReplacementPlugin = require("./HotModuleReplacementPlugin");
							 | 
						
					
						
							
								
									
										
										
										
											2013-06-19 19:49:57 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										compiler.apply(new HotModuleReplacementPlugin(options.output));
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									if(options.devtool == "eval")
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										compiler.apply(new EvalDevToolModulePlugin());
							 | 
						
					
						
							
								
									
										
										
										
											2013-07-04 20:08:47 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									else if(options.devtool == "@eval")
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										compiler.apply(new EvalDevToolModulePlugin("//@ sourceURL=[url]"));
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									else if(options.devtool == "#eval")
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										compiler.apply(new EvalDevToolModulePlugin("//# sourceURL=[url]"));
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									else if(options.devtool == "#@eval")
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										compiler.apply(new EvalDevToolModulePlugin("//@ sourceURL=[url]\n//# sourceURL=[url]"));
							 | 
						
					
						
							
								
									
										
										
										
											2013-03-26 23:54:41 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									else if(options.devtool == "sourcemap" || options.devtool == "source-map")
							 | 
						
					
						
							
								
									
										
										
										
											2013-12-18 06:21:49 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										compiler.apply(new SourceMapDevToolPlugin(options.output.sourceMapFilename));
							 | 
						
					
						
							
								
									
										
										
										
											2013-07-04 20:08:47 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									else if(options.devtool == "@sourcemap" || options.devtool == "@source-map")
							 | 
						
					
						
							
								
									
										
										
										
											2013-12-18 06:21:49 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										compiler.apply(new SourceMapDevToolPlugin(options.output.sourceMapFilename, "\n/*\n//@ sourceMappingURL=[url]\n*/"));
							 | 
						
					
						
							
								
									
										
										
										
											2013-07-04 20:08:47 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									else if(options.devtool == "#sourcemap" || options.devtool == "#source-map")
							 | 
						
					
						
							
								
									
										
										
										
											2013-12-18 06:21:49 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										compiler.apply(new SourceMapDevToolPlugin(options.output.sourceMapFilename, "\n//# sourceMappingURL=[url]"));
							 | 
						
					
						
							
								
									
										
										
										
											2013-07-04 20:08:47 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									else if(options.devtool == "#@sourcemap" || options.devtool == "#@source-map")
							 | 
						
					
						
							
								
									
										
										
										
											2013-12-18 06:21:49 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										compiler.apply(new SourceMapDevToolPlugin(options.output.sourceMapFilename, "\n/*\n//@ sourceMappingURL=[url]\n//# sourceMappingURL=[url]\n*/"));
							 | 
						
					
						
							
								
									
										
										
										
											2013-03-26 23:54:41 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									else if(options.devtool == "inlinesourcemap" ||
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											options.devtool == "inline-sourcemap" ||
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											options.devtool == "inline-source-map")
							 | 
						
					
						
							
								
									
										
										
										
											2013-12-18 06:21:49 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										compiler.apply(new SourceMapDevToolPlugin());
							 | 
						
					
						
							
								
									
										
										
										
											2013-07-04 20:08:47 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									else if(options.devtool == "@inlinesourcemap" ||
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											options.devtool == "@inline-sourcemap" ||
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											options.devtool == "@inline-source-map")
							 | 
						
					
						
							
								
									
										
										
										
											2013-12-18 06:21:49 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										compiler.apply(new SourceMapDevToolPlugin(null, "\n/*\n//@ sourceMappingURL=[url]\n*/"));
							 | 
						
					
						
							
								
									
										
										
										
											2013-07-04 20:08:47 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									else if(options.devtool == "#inlinesourcemap" ||
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											options.devtool == "#inline-sourcemap" ||
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											options.devtool == "#inline-source-map")
							 | 
						
					
						
							
								
									
										
										
										
											2013-12-18 06:21:49 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										compiler.apply(new SourceMapDevToolPlugin(null, "\n//# sourceMappingURL=[url]"));
							 | 
						
					
						
							
								
									
										
										
										
											2013-07-04 20:08:47 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									else if(options.devtool == "#@inlinesourcemap" ||
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											options.devtool == "#@inline-sourcemap" ||
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											options.devtool == "#@inline-source-map")
							 | 
						
					
						
							
								
									
										
										
										
											2013-12-18 06:21:49 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										compiler.apply(new SourceMapDevToolPlugin(null, "\n/*\n//@ sourceMappingURL=[url]\n//# sourceMappingURL=[url]\n*/"));
							 | 
						
					
						
							
								
									
										
										
										
											2013-06-19 17:53:03 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2013-01-31 08:44:39 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									function itemToPlugin(item, name) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if(Array.isArray(item))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											return new MultiEntryPlugin(options.context, item, name);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										else
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											return new SingleEntryPlugin(options.context, item, name)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									if(typeof options.entry == "string" || Array.isArray(options.entry)) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										compiler.apply(itemToPlugin(options.entry, "main"));
							 | 
						
					
						
							
								
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									} else if(typeof options.entry == "object") {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										Object.keys(options.entry).forEach(function(name) {
							 | 
						
					
						
							
								
									
										
										
										
											2013-01-31 08:44:39 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											compiler.apply(itemToPlugin(options.entry[name], name));
							 | 
						
					
						
							
								
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										});
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									}
							 | 
						
					
						
							
								
									
										
										
										
											2013-06-19 17:53:03 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2013-05-13 19:34:00 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									if(options.prefetch) {
							 | 
						
					
						
							
								
									
										
										
										
											2013-12-18 06:21:49 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										compiler.apply(new MovedToPluginWarningPlugin("prefetch", "PrefetchPlugin"));
							 | 
						
					
						
							
								
									
										
										
										
											2013-07-11 05:20:07 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										var PrefetchPlugin = require("./PrefetchPlugin");
							 | 
						
					
						
							
								
									
										
										
										
											2013-05-13 19:34:00 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										options.prefetch.map(function(request) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											compiler.apply(new PrefetchPlugin(options.context, request));
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										});
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									}
							 | 
						
					
						
							
								
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									compiler.apply(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										new CompatibilityPlugin(),
							 | 
						
					
						
							
								
									
										
										
										
											2013-10-28 23:21:29 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										new LoaderPlugin(),
							 | 
						
					
						
							
								
									
										
										
										
											2013-12-18 06:21:49 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										new NodeStuffPlugin(options.node),
							 | 
						
					
						
							
								
									
										
										
										
											2013-02-14 04:24:00 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										new RequireJsStuffPlugin(),
							 | 
						
					
						
							
								
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										new APIPlugin(),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										new ConstPlugin(),
							 | 
						
					
						
							
								
									
										
										
										
											2013-02-16 00:08:14 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										new RequireIncludePlugin(),
							 | 
						
					
						
							
								
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										new RequireEnsurePlugin(),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										new RequireContextPlugin(options.resolve.modulesDirectories, options.resolve.extensions),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										new AMDPlugin(options.amd || {}),
							 | 
						
					
						
							
								
									
										
										
										
											2013-12-18 06:21:49 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										new CommonJsPlugin()
							 | 
						
					
						
							
								
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									compiler.apply(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										new RemoveParentModulesPlugin(),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										new RemoveEmptyChunksPlugin(),
							 | 
						
					
						
							
								
									
										
										
										
											2013-02-24 09:05:55 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										new MergeDuplicateChunksPlugin(),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										new FlagIncludedChunksPlugin()
							 | 
						
					
						
							
								
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									);
							 | 
						
					
						
							
								
									
										
										
										
											2013-05-08 19:28:54 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2013-05-31 18:22:40 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									compiler.apply(new RecordIdsPlugin());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2013-07-11 05:20:07 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									if(options.optimize && options.optimize.occurenceOrder) {
							 | 
						
					
						
							
								
									
										
										
										
											2013-12-18 06:21:49 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										compiler.apply(new MovedToPluginWarningPlugin("optimize.occurenceOrder", "optimize.OccurenceOrderPlugin"));
							 | 
						
					
						
							
								
									
										
										
										
											2013-07-11 05:20:07 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										var OccurenceOrderPlugin = require("./optimize/OccurenceOrderPlugin");
							 | 
						
					
						
							
								
									
										
										
										
											2013-05-08 19:28:54 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										compiler.apply(new OccurenceOrderPlugin(options.optimize.occurenceOrderPreferEntry));
							 | 
						
					
						
							
								
									
										
										
										
											2013-07-11 05:20:07 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									}
							 | 
						
					
						
							
								
									
										
										
										
											2013-05-08 19:28:54 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2013-07-11 05:20:07 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									if(options.optimize && options.optimize.minChunkSize) {
							 | 
						
					
						
							
								
									
										
										
										
											2013-12-18 06:21:49 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										compiler.apply(new MovedToPluginWarningPlugin("optimize.minChunkSize", "optimize.MinChunkSizePlugin"));
							 | 
						
					
						
							
								
									
										
										
										
											2013-07-11 05:20:07 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										var MinChunkSizePlugin = require("./optimize/MinChunkSizePlugin");
							 | 
						
					
						
							
								
									
										
										
										
											2013-06-18 00:55:11 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										compiler.apply(new MinChunkSizePlugin(options.optimize));
							 | 
						
					
						
							
								
									
										
										
										
											2013-07-11 05:20:07 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									}
							 | 
						
					
						
							
								
									
										
										
										
											2013-02-11 17:52:19 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2013-07-11 05:20:07 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									if(options.optimize && options.optimize.maxChunks) {
							 | 
						
					
						
							
								
									
										
										
										
											2013-12-18 06:21:49 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										compiler.apply(new MovedToPluginWarningPlugin("optimize.maxChunks", "optimize.LimitChunkCountPlugin"));
							 | 
						
					
						
							
								
									
										
										
										
											2013-07-11 05:20:07 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										var LimitChunkCountPlugin = require("./optimize/LimitChunkCountPlugin");
							 | 
						
					
						
							
								
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										compiler.apply(new LimitChunkCountPlugin(options.optimize));
							 | 
						
					
						
							
								
									
										
										
										
											2013-07-11 05:20:07 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									}
							 | 
						
					
						
							
								
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2013-07-11 05:20:07 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									if(options.optimize.minimize) {
							 | 
						
					
						
							
								
									
										
										
										
											2013-12-18 06:21:49 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										compiler.apply(new MovedToPluginWarningPlugin("optimize.minimize", "optimize.UglifyJsPlugin"));
							 | 
						
					
						
							
								
									
										
										
										
											2013-07-11 05:20:07 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										var UglifyJsPlugin = require("./optimize/UglifyJsPlugin");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if(options.optimize.minimize === true)
							 | 
						
					
						
							
								
									
										
										
										
											2013-12-18 06:21:49 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											compiler.apply(new UglifyJsPlugin());
							 | 
						
					
						
							
								
									
										
										
										
											2013-07-11 05:20:07 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										else
							 | 
						
					
						
							
								
									
										
										
										
											2013-12-18 06:21:49 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											compiler.apply(new UglifyJsPlugin(options.optimize.minimize));
							 | 
						
					
						
							
								
									
										
										
										
											2013-07-11 05:20:07 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									}
							 | 
						
					
						
							
								
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2013-07-11 05:20:07 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									if(options.optimize.dedupe === true) {
							 | 
						
					
						
							
								
									
										
										
										
											2013-12-18 06:21:49 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										compiler.apply(new MovedToPluginWarningPlugin("optimize.dedupe", "optimize.DedupePlugin"));
							 | 
						
					
						
							
								
									
										
										
										
											2013-07-11 05:20:07 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										var DedupePlugin = require("./optimize/DedupePlugin");
							 | 
						
					
						
							
								
									
										
										
										
											2013-06-12 22:16:06 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										compiler.apply(new DedupePlugin());
							 | 
						
					
						
							
								
									
										
										
										
											2013-07-11 05:20:07 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									}
							 | 
						
					
						
							
								
									
										
										
										
											2013-06-12 22:16:06 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2013-07-11 05:20:07 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									if(options.cache === undefined ? options.watch : options.cache) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										var CachePlugin = require("./CachePlugin");
							 | 
						
					
						
							
								
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										compiler.apply(new CachePlugin(typeof options.cache == "object" ? options.cache : null));
							 | 
						
					
						
							
								
									
										
										
										
											2013-07-11 05:20:07 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									}
							 | 
						
					
						
							
								
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2013-02-11 03:37:30 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									if(typeof options.provide === "object") {
							 | 
						
					
						
							
								
									
										
										
										
											2013-12-18 06:21:49 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										compiler.apply(new MovedToPluginWarningPlugin("provide", "ProvidePlugin"));
							 | 
						
					
						
							
								
									
										
										
										
											2013-07-11 05:20:07 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										var ProvidePlugin = require("./ProvidePlugin");
							 | 
						
					
						
							
								
									
										
										
										
											2013-12-18 06:21:49 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										compiler.apply(new ProvidePlugin(name, options.provide));
							 | 
						
					
						
							
								
									
										
										
										
											2013-02-11 03:37:30 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2013-12-18 06:21:49 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									if(options.define) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										compiler.apply(new MovedToPluginWarningPlugin("define", "DefinePlugin"));
							 | 
						
					
						
							
								
									
										
										
										
											2013-09-13 17:17:57 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										var defineObject = {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if(typeof options.define === "object") {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											Object.keys(options.define).forEach(function(key) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												defineObject[key] = options.define[key];
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											});
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										compiler.apply(new DefinePlugin(defineObject));
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									}
							 | 
						
					
						
							
								
									
										
										
										
											2013-12-18 06:21:49 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									if(options.defineDebug !== false)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										compiler.apply(new DefinePlugin({ DEBUG: !!options.debug }));
							 | 
						
					
						
							
								
									
										
										
										
											2013-09-13 17:17:57 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									compiler.applyPlugins("after-plugins", compiler);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									compiler.resolvers.normal.apply(
							 | 
						
					
						
							
								
									
										
										
										
											2013-07-04 18:01:10 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										new UnsafeCachePlugin(options.resolve.unsafeCache),
							 | 
						
					
						
							
								
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										new ModuleAliasPlugin(options.resolve.alias),
							 | 
						
					
						
							
								
									
										
										
										
											2013-02-11 03:37:30 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										makeRootPlugin("module", options.resolve.root),
							 | 
						
					
						
							
								
									
										
										
										
											2013-02-04 20:59:43 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										new ModulesInDirectoriesPlugin("module", options.resolve.modulesDirectories),
							 | 
						
					
						
							
								
									
										
										
										
											2013-02-11 03:37:30 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										makeRootPlugin("module", options.resolve.fallback),
							 | 
						
					
						
							
								
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										new ModuleAsFilePlugin("module"),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										new ModuleAsDirectoryPlugin("module"),
							 | 
						
					
						
							
								
									
										
										
										
											2013-10-13 04:08:04 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										new DirectoryDescriptionFilePlugin("package.json", options.resolve.packageMains),
							 | 
						
					
						
							
								
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										new DirectoryDefaultFilePlugin(["index"]),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										new FileAppendPlugin(options.resolve.extensions)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									compiler.resolvers.context.apply(
							 | 
						
					
						
							
								
									
										
										
										
											2013-07-04 18:01:10 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										new UnsafeCachePlugin(options.resolve.unsafeCache),
							 | 
						
					
						
							
								
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										new ModuleAliasPlugin(options.resolve.alias),
							 | 
						
					
						
							
								
									
										
										
										
											2013-02-11 03:37:30 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										makeRootPlugin("module", options.resolve.root),
							 | 
						
					
						
							
								
									
										
										
										
											2013-02-04 20:59:43 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										new ModulesInDirectoriesPlugin("module", options.resolve.modulesDirectories),
							 | 
						
					
						
							
								
									
										
										
										
											2013-02-11 03:37:30 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										makeRootPlugin("module", options.resolve.fallback),
							 | 
						
					
						
							
								
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										new ModuleAsFilePlugin("module"),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										new ModuleAsDirectoryPlugin("module"),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										new DirectoryResultPlugin()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									compiler.resolvers.loader.apply(
							 | 
						
					
						
							
								
									
										
										
										
											2013-07-04 18:01:10 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										new UnsafeCachePlugin(options.resolve.unsafeCache),
							 | 
						
					
						
							
								
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										new ModuleAliasPlugin(options.resolveLoader.alias),
							 | 
						
					
						
							
								
									
										
										
										
											2013-02-11 03:37:30 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										makeRootPlugin("loader-module", options.resolveLoader.root),
							 | 
						
					
						
							
								
									
										
										
										
											2013-02-04 20:59:43 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										new ModulesInDirectoriesPlugin("loader-module", options.resolveLoader.modulesDirectories),
							 | 
						
					
						
							
								
									
										
										
										
											2013-02-11 03:37:30 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										makeRootPlugin("loader-module", options.resolveLoader.fallback),
							 | 
						
					
						
							
								
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										new ModuleTemplatesPlugin("loader-module", options.resolveLoader.moduleTemplates, "module"),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										new ModuleAsFilePlugin("module"),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										new ModuleAsDirectoryPlugin("module"),
							 | 
						
					
						
							
								
									
										
										
										
											2013-10-13 04:08:04 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										new DirectoryDescriptionFilePlugin("package.json", options.resolveLoader.packageMains),
							 | 
						
					
						
							
								
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										new DirectoryDefaultFilePlugin(["index"]),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										new FileAppendPlugin(options.resolveLoader.extensions)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									compiler.applyPlugins("after-resolvers", compiler);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									return options;
							 | 
						
					
						
							
								
									
										
										
										
											2013-02-04 17:47:00 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2013-02-11 03:37:30 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								function makeRootPlugin(name, root) {
							 | 
						
					
						
							
								
									
										
										
										
											2013-02-04 17:47:00 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									if(typeof root === "string")
							 | 
						
					
						
							
								
									
										
										
										
											2013-02-11 03:37:30 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										return new ModulesInRootPlugin(name, root);
							 | 
						
					
						
							
								
									
										
										
										
											2013-02-04 17:47:00 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									else if(Array.isArray(root)) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return function() {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											root.forEach(function(root) {
							 | 
						
					
						
							
								
									
										
										
										
											2013-02-11 18:10:15 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
												this.apply(new ModulesInRootPlugin(name, root));
							 | 
						
					
						
							
								
									
										
										
										
											2013-02-04 17:47:00 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											}, this);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									return function() {};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 |