| 
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 |  |  | /* | 
					
						
							|  |  |  | 	MIT License http://www.opensource.org/licenses/mit-license.php
 | 
					
						
							|  |  |  | 	Author Tobias Koppers @sokra | 
					
						
							|  |  |  | */ | 
					
						
							| 
									
										
										
										
											2017-02-21 21:49:15 +08:00
										 |  |  | "use strict"; | 
					
						
							| 
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-21 21:49:15 +08:00
										 |  |  | const OptionsApply = require("./OptionsApply"); | 
					
						
							| 
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-21 21:49:15 +08:00
										 |  |  | const LoaderTargetPlugin = require("./LoaderTargetPlugin"); | 
					
						
							|  |  |  | const FunctionModulePlugin = require("./FunctionModulePlugin"); | 
					
						
							|  |  |  | const EvalDevToolModulePlugin = require("./EvalDevToolModulePlugin"); | 
					
						
							|  |  |  | const SourceMapDevToolPlugin = require("./SourceMapDevToolPlugin"); | 
					
						
							|  |  |  | const EvalSourceMapDevToolPlugin = require("./EvalSourceMapDevToolPlugin"); | 
					
						
							| 
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-21 21:49:15 +08:00
										 |  |  | const EntryOptionPlugin = require("./EntryOptionPlugin"); | 
					
						
							|  |  |  | const RecordIdsPlugin = require("./RecordIdsPlugin"); | 
					
						
							| 
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-21 21:49:15 +08:00
										 |  |  | const APIPlugin = require("./APIPlugin"); | 
					
						
							|  |  |  | const ConstPlugin = require("./ConstPlugin"); | 
					
						
							|  |  |  | const RequireJsStuffPlugin = require("./RequireJsStuffPlugin"); | 
					
						
							|  |  |  | const NodeStuffPlugin = require("./NodeStuffPlugin"); | 
					
						
							|  |  |  | const CompatibilityPlugin = require("./CompatibilityPlugin"); | 
					
						
							| 
									
										
										
										
											2013-12-18 06:21:49 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-21 21:49:15 +08:00
										 |  |  | const TemplatedPathPlugin = require("./TemplatedPathPlugin"); | 
					
						
							|  |  |  | const WarnCaseSensitiveModulesPlugin = require("./WarnCaseSensitiveModulesPlugin"); | 
					
						
							|  |  |  | const UseStrictPlugin = require("./UseStrictPlugin"); | 
					
						
							| 
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-21 21:49:15 +08:00
										 |  |  | const LoaderPlugin = require("./dependencies/LoaderPlugin"); | 
					
						
							|  |  |  | const CommonJsPlugin = require("./dependencies/CommonJsPlugin"); | 
					
						
							|  |  |  | const HarmonyModulesPlugin = require("./dependencies/HarmonyModulesPlugin"); | 
					
						
							|  |  |  | const SystemPlugin = require("./dependencies/SystemPlugin"); | 
					
						
							|  |  |  | const ImportPlugin = require("./dependencies/ImportPlugin"); | 
					
						
							|  |  |  | const AMDPlugin = require("./dependencies/AMDPlugin"); | 
					
						
							|  |  |  | const RequireContextPlugin = require("./dependencies/RequireContextPlugin"); | 
					
						
							|  |  |  | const RequireEnsurePlugin = require("./dependencies/RequireEnsurePlugin"); | 
					
						
							|  |  |  | const RequireIncludePlugin = require("./dependencies/RequireIncludePlugin"); | 
					
						
							| 
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-21 21:49:15 +08:00
										 |  |  | const EnsureChunkConditionsPlugin = require("./optimize/EnsureChunkConditionsPlugin"); | 
					
						
							|  |  |  | const RemoveParentModulesPlugin = require("./optimize/RemoveParentModulesPlugin"); | 
					
						
							|  |  |  | const RemoveEmptyChunksPlugin = require("./optimize/RemoveEmptyChunksPlugin"); | 
					
						
							|  |  |  | const MergeDuplicateChunksPlugin = require("./optimize/MergeDuplicateChunksPlugin"); | 
					
						
							|  |  |  | const FlagIncludedChunksPlugin = require("./optimize/FlagIncludedChunksPlugin"); | 
					
						
							|  |  |  | const OccurrenceOrderPlugin = require("./optimize/OccurrenceOrderPlugin"); | 
					
						
							|  |  |  | const FlagDependencyUsagePlugin = require("./FlagDependencyUsagePlugin"); | 
					
						
							|  |  |  | const FlagDependencyExportsPlugin = require("./FlagDependencyExportsPlugin"); | 
					
						
							|  |  |  | const SizeLimitsPlugin = require("./performance/SizeLimitsPlugin"); | 
					
						
							| 
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-21 21:49:15 +08:00
										 |  |  | const ResolverFactory = require("enhanced-resolve").ResolverFactory; | 
					
						
							| 
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-21 21:49:15 +08:00
										 |  |  | class WebpackOptionsApply extends OptionsApply { | 
					
						
							|  |  |  | 	constructor() { | 
					
						
							|  |  |  | 		super(); | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2016-05-20 13:39:36 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-21 21:49:15 +08:00
										 |  |  | 	process(options, compiler) { | 
					
						
							|  |  |  | 		let ExternalsPlugin; | 
					
						
							|  |  |  | 		compiler.outputPath = options.output.path; | 
					
						
							|  |  |  | 		compiler.recordsInputPath = options.recordsInputPath || options.recordsPath; | 
					
						
							|  |  |  | 		compiler.recordsOutputPath = options.recordsOutputPath || options.recordsPath; | 
					
						
							|  |  |  | 		compiler.name = options.name; | 
					
						
							|  |  |  | 		compiler.dependencies = options.dependencies; | 
					
						
							|  |  |  | 		if(typeof options.target === "string") { | 
					
						
							|  |  |  | 			let JsonpTemplatePlugin; | 
					
						
							|  |  |  | 			let NodeSourcePlugin; | 
					
						
							|  |  |  | 			let NodeTargetPlugin; | 
					
						
							|  |  |  | 			let NodeTemplatePlugin; | 
					
						
							| 
									
										
										
										
											2016-12-03 04:49:42 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-21 21:49:15 +08:00
										 |  |  | 			switch(options.target) { | 
					
						
							|  |  |  | 				case "web": | 
					
						
							|  |  |  | 					JsonpTemplatePlugin = require("./JsonpTemplatePlugin"); | 
					
						
							|  |  |  | 					NodeSourcePlugin = require("./node/NodeSourcePlugin"); | 
					
						
							|  |  |  | 					compiler.apply( | 
					
						
							|  |  |  | 						new JsonpTemplatePlugin(options.output), | 
					
						
							|  |  |  | 						new FunctionModulePlugin(options.output), | 
					
						
							|  |  |  | 						new NodeSourcePlugin(options.node), | 
					
						
							| 
									
										
										
										
											2017-06-30 23:41:45 +08:00
										 |  |  | 						new LoaderTargetPlugin(options.target) | 
					
						
							| 
									
										
										
										
											2017-02-21 21:49:15 +08:00
										 |  |  | 					); | 
					
						
							|  |  |  | 					break; | 
					
						
							|  |  |  | 				case "webworker": | 
					
						
							|  |  |  | 					{ | 
					
						
							|  |  |  | 						let WebWorkerTemplatePlugin = require("./webworker/WebWorkerTemplatePlugin"); | 
					
						
							|  |  |  | 						NodeSourcePlugin = require("./node/NodeSourcePlugin"); | 
					
						
							|  |  |  | 						compiler.apply( | 
					
						
							| 
									
										
										
										
											2017-03-18 20:38:47 +08:00
										 |  |  | 							new WebWorkerTemplatePlugin(), | 
					
						
							| 
									
										
										
										
											2017-02-21 21:49:15 +08:00
										 |  |  | 							new FunctionModulePlugin(options.output), | 
					
						
							|  |  |  | 							new NodeSourcePlugin(options.node), | 
					
						
							| 
									
										
										
										
											2017-06-30 23:41:45 +08:00
										 |  |  | 							new LoaderTargetPlugin(options.target) | 
					
						
							| 
									
										
										
										
											2017-02-21 21:49:15 +08:00
										 |  |  | 						); | 
					
						
							|  |  |  | 						break; | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 				case "node": | 
					
						
							|  |  |  | 				case "async-node": | 
					
						
							|  |  |  | 					NodeTemplatePlugin = require("./node/NodeTemplatePlugin"); | 
					
						
							|  |  |  | 					NodeTargetPlugin = require("./node/NodeTargetPlugin"); | 
					
						
							|  |  |  | 					compiler.apply( | 
					
						
							|  |  |  | 						new NodeTemplatePlugin({ | 
					
						
							|  |  |  | 							asyncChunkLoading: options.target === "async-node" | 
					
						
							|  |  |  | 						}), | 
					
						
							|  |  |  | 						new FunctionModulePlugin(options.output), | 
					
						
							|  |  |  | 						new NodeTargetPlugin(), | 
					
						
							|  |  |  | 						new LoaderTargetPlugin("node") | 
					
						
							|  |  |  | 					); | 
					
						
							|  |  |  | 					break; | 
					
						
							|  |  |  | 				case "node-webkit": | 
					
						
							|  |  |  | 					JsonpTemplatePlugin = require("./JsonpTemplatePlugin"); | 
					
						
							|  |  |  | 					NodeTargetPlugin = require("./node/NodeTargetPlugin"); | 
					
						
							|  |  |  | 					ExternalsPlugin = require("./ExternalsPlugin"); | 
					
						
							|  |  |  | 					compiler.apply( | 
					
						
							|  |  |  | 						new JsonpTemplatePlugin(options.output), | 
					
						
							|  |  |  | 						new FunctionModulePlugin(options.output), | 
					
						
							|  |  |  | 						new NodeTargetPlugin(), | 
					
						
							|  |  |  | 						new ExternalsPlugin("commonjs", "nw.gui"), | 
					
						
							| 
									
										
										
										
											2017-06-30 23:41:45 +08:00
										 |  |  | 						new LoaderTargetPlugin(options.target) | 
					
						
							| 
									
										
										
										
											2017-02-21 21:49:15 +08:00
										 |  |  | 					); | 
					
						
							|  |  |  | 					break; | 
					
						
							|  |  |  | 				case "atom": | 
					
						
							|  |  |  | 				case "electron": | 
					
						
							|  |  |  | 				case "electron-main": | 
					
						
							|  |  |  | 					NodeTemplatePlugin = require("./node/NodeTemplatePlugin"); | 
					
						
							|  |  |  | 					NodeTargetPlugin = require("./node/NodeTargetPlugin"); | 
					
						
							|  |  |  | 					ExternalsPlugin = require("./ExternalsPlugin"); | 
					
						
							|  |  |  | 					compiler.apply( | 
					
						
							|  |  |  | 						new NodeTemplatePlugin({ | 
					
						
							|  |  |  | 							asyncChunkLoading: true | 
					
						
							|  |  |  | 						}), | 
					
						
							|  |  |  | 						new FunctionModulePlugin(options.output), | 
					
						
							|  |  |  | 						new NodeTargetPlugin(), | 
					
						
							|  |  |  | 						new ExternalsPlugin("commonjs", [ | 
					
						
							|  |  |  | 							"app", | 
					
						
							|  |  |  | 							"auto-updater", | 
					
						
							|  |  |  | 							"browser-window", | 
					
						
							|  |  |  | 							"content-tracing", | 
					
						
							|  |  |  | 							"dialog", | 
					
						
							|  |  |  | 							"electron", | 
					
						
							|  |  |  | 							"global-shortcut", | 
					
						
							|  |  |  | 							"ipc", | 
					
						
							|  |  |  | 							"ipc-main", | 
					
						
							|  |  |  | 							"menu", | 
					
						
							|  |  |  | 							"menu-item", | 
					
						
							|  |  |  | 							"power-monitor", | 
					
						
							|  |  |  | 							"power-save-blocker", | 
					
						
							|  |  |  | 							"protocol", | 
					
						
							|  |  |  | 							"session", | 
					
						
							|  |  |  | 							"web-contents", | 
					
						
							|  |  |  | 							"tray", | 
					
						
							|  |  |  | 							"clipboard", | 
					
						
							|  |  |  | 							"crash-reporter", | 
					
						
							|  |  |  | 							"native-image", | 
					
						
							|  |  |  | 							"screen", | 
					
						
							|  |  |  | 							"shell" | 
					
						
							|  |  |  | 						]), | 
					
						
							|  |  |  | 						new LoaderTargetPlugin(options.target) | 
					
						
							|  |  |  | 					); | 
					
						
							|  |  |  | 					break; | 
					
						
							|  |  |  | 				case "electron-renderer": | 
					
						
							|  |  |  | 					JsonpTemplatePlugin = require("./JsonpTemplatePlugin"); | 
					
						
							|  |  |  | 					NodeTargetPlugin = require("./node/NodeTargetPlugin"); | 
					
						
							|  |  |  | 					ExternalsPlugin = require("./ExternalsPlugin"); | 
					
						
							|  |  |  | 					compiler.apply( | 
					
						
							|  |  |  | 						new JsonpTemplatePlugin(options.output), | 
					
						
							|  |  |  | 						new FunctionModulePlugin(options.output), | 
					
						
							|  |  |  | 						new NodeTargetPlugin(), | 
					
						
							|  |  |  | 						new ExternalsPlugin("commonjs", [ | 
					
						
							|  |  |  | 							"desktop-capturer", | 
					
						
							|  |  |  | 							"electron", | 
					
						
							|  |  |  | 							"ipc", | 
					
						
							|  |  |  | 							"ipc-renderer", | 
					
						
							|  |  |  | 							"remote", | 
					
						
							|  |  |  | 							"web-frame", | 
					
						
							|  |  |  | 							"clipboard", | 
					
						
							|  |  |  | 							"crash-reporter", | 
					
						
							|  |  |  | 							"native-image", | 
					
						
							|  |  |  | 							"screen", | 
					
						
							|  |  |  | 							"shell" | 
					
						
							|  |  |  | 						]), | 
					
						
							|  |  |  | 						new LoaderTargetPlugin(options.target) | 
					
						
							|  |  |  | 					); | 
					
						
							|  |  |  | 					break; | 
					
						
							|  |  |  | 				default: | 
					
						
							|  |  |  | 					throw new Error("Unsupported target '" + options.target + "'."); | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} else if(options.target !== false) { | 
					
						
							|  |  |  | 			options.target(compiler); | 
					
						
							|  |  |  | 		} else { | 
					
						
							|  |  |  | 			throw new Error("Unsupported target '" + options.target + "'."); | 
					
						
							| 
									
										
										
										
											2014-04-09 15:12:04 +08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2016-12-03 04:49:42 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-21 21:49:15 +08:00
										 |  |  | 		if(options.output.library || options.output.libraryTarget !== "var") { | 
					
						
							|  |  |  | 			let LibraryTemplatePlugin = require("./LibraryTemplatePlugin"); | 
					
						
							| 
									
										
										
										
											2017-06-02 20:52:41 +08:00
										 |  |  | 			compiler.apply(new LibraryTemplatePlugin(options.output.library, options.output.libraryTarget, options.output.umdNamedDefine, options.output.auxiliaryComment || "", options.output.libraryExport)); | 
					
						
							| 
									
										
										
										
											2017-02-21 21:49:15 +08:00
										 |  |  | 		} | 
					
						
							|  |  |  | 		if(options.externals) { | 
					
						
							|  |  |  | 			ExternalsPlugin = require("./ExternalsPlugin"); | 
					
						
							|  |  |  | 			compiler.apply(new ExternalsPlugin(options.output.libraryTarget, options.externals)); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		let noSources; | 
					
						
							|  |  |  | 		let legacy; | 
					
						
							|  |  |  | 		let modern; | 
					
						
							|  |  |  | 		let comment; | 
					
						
							|  |  |  | 		if(options.devtool && (options.devtool.indexOf("sourcemap") >= 0 || options.devtool.indexOf("source-map") >= 0)) { | 
					
						
							|  |  |  | 			const hidden = options.devtool.indexOf("hidden") >= 0; | 
					
						
							|  |  |  | 			const inline = options.devtool.indexOf("inline") >= 0; | 
					
						
							|  |  |  | 			const evalWrapped = options.devtool.indexOf("eval") >= 0; | 
					
						
							|  |  |  | 			const cheap = options.devtool.indexOf("cheap") >= 0; | 
					
						
							|  |  |  | 			const moduleMaps = options.devtool.indexOf("module") >= 0; | 
					
						
							|  |  |  | 			noSources = options.devtool.indexOf("nosources") >= 0; | 
					
						
							|  |  |  | 			legacy = options.devtool.indexOf("@") >= 0; | 
					
						
							|  |  |  | 			modern = options.devtool.indexOf("#") >= 0; | 
					
						
							| 
									
										
										
										
											2017-04-17 16:02:36 +08:00
										 |  |  | 			comment = legacy && modern ? "\n/*\n//@ source" + "MappingURL=[url]\n//# source" + "MappingURL=[url]\n*/" : | 
					
						
							|  |  |  | 				legacy ? "\n/*\n//@ source" + "MappingURL=[url]\n*/" : | 
					
						
							|  |  |  | 				modern ? "\n//# source" + "MappingURL=[url]" : | 
					
						
							| 
									
										
										
										
											2017-02-21 21:49:15 +08:00
										 |  |  | 				null; | 
					
						
							|  |  |  | 			let Plugin = evalWrapped ? EvalSourceMapDevToolPlugin : SourceMapDevToolPlugin; | 
					
						
							|  |  |  | 			compiler.apply(new Plugin({ | 
					
						
							|  |  |  | 				filename: inline ? null : options.output.sourceMapFilename, | 
					
						
							|  |  |  | 				moduleFilenameTemplate: options.output.devtoolModuleFilenameTemplate, | 
					
						
							|  |  |  | 				fallbackModuleFilenameTemplate: options.output.devtoolFallbackModuleFilenameTemplate, | 
					
						
							|  |  |  | 				append: hidden ? false : comment, | 
					
						
							|  |  |  | 				module: moduleMaps ? true : cheap ? false : true, | 
					
						
							|  |  |  | 				columns: cheap ? false : true, | 
					
						
							|  |  |  | 				lineToLine: options.output.devtoolLineToLine, | 
					
						
							|  |  |  | 				noSources: noSources, | 
					
						
							|  |  |  | 			})); | 
					
						
							|  |  |  | 		} else if(options.devtool && options.devtool.indexOf("eval") >= 0) { | 
					
						
							|  |  |  | 			legacy = options.devtool.indexOf("@") >= 0; | 
					
						
							|  |  |  | 			modern = options.devtool.indexOf("#") >= 0; | 
					
						
							|  |  |  | 			comment = legacy && modern ? "\n//@ sourceURL=[url]\n//# sourceURL=[url]" : | 
					
						
							|  |  |  | 				legacy ? "\n//@ sourceURL=[url]" : | 
					
						
							|  |  |  | 				modern ? "\n//# sourceURL=[url]" : | 
					
						
							|  |  |  | 				null; | 
					
						
							|  |  |  | 			compiler.apply(new EvalDevToolModulePlugin(comment, options.output.devtoolModuleFilenameTemplate)); | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2013-06-19 17:53:03 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-21 21:49:15 +08:00
										 |  |  | 		compiler.apply(new EntryOptionPlugin()); | 
					
						
							|  |  |  | 		compiler.applyPluginsBailResult("entry-option", options.context, options.entry); | 
					
						
							| 
									
										
										
										
											2013-06-19 17:53:03 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-21 21:49:15 +08:00
										 |  |  | 		compiler.apply( | 
					
						
							|  |  |  | 			new CompatibilityPlugin(), | 
					
						
							|  |  |  | 			new HarmonyModulesPlugin(options.module), | 
					
						
							|  |  |  | 			new AMDPlugin(options.module, options.amd || {}), | 
					
						
							|  |  |  | 			new CommonJsPlugin(options.module), | 
					
						
							|  |  |  | 			new LoaderPlugin(), | 
					
						
							|  |  |  | 			new NodeStuffPlugin(options.node), | 
					
						
							|  |  |  | 			new RequireJsStuffPlugin(), | 
					
						
							|  |  |  | 			new APIPlugin(), | 
					
						
							|  |  |  | 			new ConstPlugin(), | 
					
						
							|  |  |  | 			new UseStrictPlugin(), | 
					
						
							|  |  |  | 			new RequireIncludePlugin(), | 
					
						
							|  |  |  | 			new RequireEnsurePlugin(), | 
					
						
							| 
									
										
										
										
											2017-06-02 19:41:25 +08:00
										 |  |  | 			new RequireContextPlugin(options.resolve.modules, options.resolve.extensions, options.resolve.mainFiles), | 
					
						
							| 
									
										
										
										
											2017-02-21 21:49:15 +08:00
										 |  |  | 			new ImportPlugin(options.module), | 
					
						
							|  |  |  | 			new SystemPlugin(options.module) | 
					
						
							|  |  |  | 		); | 
					
						
							| 
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-21 21:49:15 +08:00
										 |  |  | 		compiler.apply( | 
					
						
							|  |  |  | 			new EnsureChunkConditionsPlugin(), | 
					
						
							|  |  |  | 			new RemoveParentModulesPlugin(), | 
					
						
							|  |  |  | 			new RemoveEmptyChunksPlugin(), | 
					
						
							|  |  |  | 			new MergeDuplicateChunksPlugin(), | 
					
						
							|  |  |  | 			new FlagIncludedChunksPlugin(), | 
					
						
							|  |  |  | 			new OccurrenceOrderPlugin(true), | 
					
						
							|  |  |  | 			new FlagDependencyExportsPlugin(), | 
					
						
							|  |  |  | 			new FlagDependencyUsagePlugin() | 
					
						
							|  |  |  | 		); | 
					
						
							| 
									
										
										
										
											2013-05-08 19:28:54 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-21 21:49:15 +08:00
										 |  |  | 		if(options.performance) { | 
					
						
							|  |  |  | 			compiler.apply(new SizeLimitsPlugin(options.performance)); | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2016-12-03 04:49:42 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-21 21:49:15 +08:00
										 |  |  | 		compiler.apply(new TemplatedPathPlugin()); | 
					
						
							| 
									
										
										
										
											2014-08-22 19:51:24 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-21 21:49:15 +08:00
										 |  |  | 		compiler.apply(new RecordIdsPlugin()); | 
					
						
							| 
									
										
										
										
											2013-05-31 18:22:40 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-21 21:49:15 +08:00
										 |  |  | 		compiler.apply(new WarnCaseSensitiveModulesPlugin()); | 
					
						
							| 
									
										
										
										
											2014-03-31 17:33:17 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-21 21:49:15 +08:00
										 |  |  | 		if(options.cache) { | 
					
						
							|  |  |  | 			let CachePlugin = require("./CachePlugin"); | 
					
						
							|  |  |  | 			compiler.apply(new CachePlugin(typeof options.cache === "object" ? options.cache : null)); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		compiler.applyPlugins("after-plugins", compiler); | 
					
						
							|  |  |  | 		if(!compiler.inputFileSystem) throw new Error("No input filesystem provided"); | 
					
						
							|  |  |  | 		compiler.resolvers.normal = ResolverFactory.createResolver(Object.assign({ | 
					
						
							|  |  |  | 			fileSystem: compiler.inputFileSystem | 
					
						
							|  |  |  | 		}, options.resolve)); | 
					
						
							|  |  |  | 		compiler.resolvers.context = ResolverFactory.createResolver(Object.assign({ | 
					
						
							|  |  |  | 			fileSystem: compiler.inputFileSystem, | 
					
						
							|  |  |  | 			resolveToContext: true | 
					
						
							|  |  |  | 		}, options.resolve)); | 
					
						
							|  |  |  | 		compiler.resolvers.loader = ResolverFactory.createResolver(Object.assign({ | 
					
						
							|  |  |  | 			fileSystem: compiler.inputFileSystem | 
					
						
							|  |  |  | 		}, options.resolveLoader)); | 
					
						
							|  |  |  | 		compiler.applyPlugins("after-resolvers", compiler); | 
					
						
							|  |  |  | 		return options; | 
					
						
							| 
									
										
										
										
											2013-07-11 05:20:07 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-02-21 21:49:15 +08:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-21 21:49:15 +08:00
										 |  |  | module.exports = WebpackOptionsApply; |