| 
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 |  |  | /* | 
					
						
							|  |  |  | 	MIT License http://www.opensource.org/licenses/mit-license.php
 | 
					
						
							|  |  |  | 	Author Tobias Koppers @sokra | 
					
						
							|  |  |  | */ | 
					
						
							| 
									
										
										
										
											2017-01-03 00:45:44 +08:00
										 |  |  | "use strict"; | 
					
						
							| 
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-19 04:18:07 +08:00
										 |  |  | const path = require("path"); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-03 00:45:44 +08:00
										 |  |  | const OptionsDefaulter = require("./OptionsDefaulter"); | 
					
						
							|  |  |  | const Template = require("./Template"); | 
					
						
							| 
									
										
										
										
											2018-01-03 23:26:55 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | const isProductionLikeMode = options => { | 
					
						
							|  |  |  | 	return options.mode === "production" || !options.mode; | 
					
						
							|  |  |  | }; | 
					
						
							| 
									
										
										
										
											2013-02-26 20:31:05 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-03 00:45:44 +08:00
										 |  |  | class WebpackOptionsDefaulter extends OptionsDefaulter { | 
					
						
							|  |  |  | 	constructor() { | 
					
						
							|  |  |  | 		super(); | 
					
						
							| 
									
										
										
										
											2017-12-19 04:18:07 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-09 23:48:39 +08:00
										 |  |  | 		this.set("entry", "./src"); | 
					
						
							| 
									
										
										
										
											2017-12-19 04:18:07 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-31 08:42:01 +08:00
										 |  |  | 		this.set("devtool", "make", options => (options.mode === "development" ? "eval" : false)); | 
					
						
							| 
									
										
										
										
											2017-11-21 17:41:01 +08:00
										 |  |  | 		this.set("cache", "make", options => options.mode === "development"); | 
					
						
							| 
									
										
										
										
											2013-02-26 20:31:05 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-03 00:45:44 +08:00
										 |  |  | 		this.set("context", process.cwd()); | 
					
						
							|  |  |  | 		this.set("target", "web"); | 
					
						
							| 
									
										
										
										
											2014-03-11 23:08:22 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-06 18:10:16 +08:00
										 |  |  | 		this.set("module", "call", value => Object.assign({}, value)); | 
					
						
							| 
									
										
										
										
											2017-01-03 00:45:44 +08:00
										 |  |  | 		this.set("module.unknownContextRequest", "."); | 
					
						
							|  |  |  | 		this.set("module.unknownContextRegExp", false); | 
					
						
							|  |  |  | 		this.set("module.unknownContextRecursive", true); | 
					
						
							|  |  |  | 		this.set("module.unknownContextCritical", true); | 
					
						
							|  |  |  | 		this.set("module.exprContextRequest", "."); | 
					
						
							|  |  |  | 		this.set("module.exprContextRegExp", false); | 
					
						
							|  |  |  | 		this.set("module.exprContextRecursive", true); | 
					
						
							|  |  |  | 		this.set("module.exprContextCritical", true); | 
					
						
							|  |  |  | 		this.set("module.wrappedContextRegExp", /.*/); | 
					
						
							|  |  |  | 		this.set("module.wrappedContextRecursive", true); | 
					
						
							|  |  |  | 		this.set("module.wrappedContextCritical", false); | 
					
						
							| 
									
										
										
										
											2017-02-23 05:31:46 +08:00
										 |  |  | 		this.set("module.strictExportPresence", false); | 
					
						
							| 
									
										
										
										
											2017-05-21 15:13:33 +08:00
										 |  |  | 		this.set("module.strictThisContextOnImports", false); | 
					
						
							| 
									
										
										
										
											2017-11-21 17:41:01 +08:00
										 |  |  | 		this.set("module.unsafeCache", "make", options => !!options.cache); | 
					
						
							| 
									
										
										
										
											2017-11-17 21:26:23 +08:00
										 |  |  | 		this.set("module.rules", []); | 
					
						
							| 
									
										
										
										
											2018-02-10 01:01:31 +08:00
										 |  |  | 		this.set("module.defaultRules", "make", options => [{ | 
					
						
							| 
									
										
										
										
											2017-12-31 08:42:01 +08:00
										 |  |  | 				type: "javascript/auto", | 
					
						
							|  |  |  | 				resolve: {} | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 			{ | 
					
						
							|  |  |  | 				test: /\.mjs$/i, | 
					
						
							| 
									
										
										
										
											2018-02-10 01:01:31 +08:00
										 |  |  | 				type: "javascript/esm", | 
					
						
							|  |  |  | 				resolve: { | 
					
						
							|  |  |  | 					mainFields: options.target === "web" || options.target === "webworker" ? ["browser", "main"] : ["main"] | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2017-12-31 08:42:01 +08:00
										 |  |  | 			}, | 
					
						
							|  |  |  | 			{ | 
					
						
							|  |  |  | 				test: /\.json$/i, | 
					
						
							|  |  |  | 				type: "json" | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 			{ | 
					
						
							|  |  |  | 				test: /\.wasm$/i, | 
					
						
							|  |  |  | 				type: "webassembly/experimental" | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		]); | 
					
						
							| 
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-03 00:45:44 +08:00
										 |  |  | 		this.set("output", "call", (value, options) => { | 
					
						
							|  |  |  | 			if(typeof value === "string") { | 
					
						
							|  |  |  | 				return { | 
					
						
							|  |  |  | 					filename: value | 
					
						
							|  |  |  | 				}; | 
					
						
							|  |  |  | 			} else if(typeof value !== "object") { | 
					
						
							|  |  |  | 				return {}; | 
					
						
							|  |  |  | 			} else { | 
					
						
							| 
									
										
										
										
											2017-09-06 18:10:16 +08:00
										 |  |  | 				return Object.assign({}, value); | 
					
						
							| 
									
										
										
										
											2017-01-03 00:45:44 +08:00
										 |  |  | 			} | 
					
						
							|  |  |  | 		}); | 
					
						
							| 
									
										
										
										
											2017-12-19 04:18:07 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-03 00:45:44 +08:00
										 |  |  | 		this.set("output.filename", "[name].js"); | 
					
						
							| 
									
										
										
										
											2017-12-31 08:42:01 +08:00
										 |  |  | 		this.set("output.chunkFilename", "make", options => { | 
					
						
							| 
									
										
										
										
											2017-02-05 08:12:01 +08:00
										 |  |  | 			const filename = options.output.filename; | 
					
						
							| 
									
										
										
										
											2018-01-20 00:06:59 +08:00
										 |  |  | 			if(typeof filename === "function") return filename; | 
					
						
							| 
									
										
										
										
											2018-01-12 00:58:39 +08:00
										 |  |  | 			const hasName = filename.includes("[name]"); | 
					
						
							| 
									
										
										
										
											2018-01-20 00:06:59 +08:00
										 |  |  | 			const hasId = filename.includes("[id]"); | 
					
						
							| 
									
										
										
										
											2018-01-12 00:58:39 +08:00
										 |  |  | 			const hasChunkHash = filename.includes("[chunkhash]"); | 
					
						
							| 
									
										
										
										
											2018-01-20 00:06:59 +08:00
										 |  |  | 			// Anything changing depending on chunk is fine
 | 
					
						
							|  |  |  | 			if(hasChunkHash || hasName || hasId) return filename; | 
					
						
							|  |  |  | 			// Elsewise prefix "[id]." in front of the basename to make it changing
 | 
					
						
							| 
									
										
										
										
											2017-11-21 17:41:01 +08:00
										 |  |  | 			return filename.replace(/(^|\/)([^/]*(?:\?|$))/, "$1[id].$2"); | 
					
						
							| 
									
										
										
										
											2017-01-03 00:45:44 +08:00
										 |  |  | 		}); | 
					
						
							| 
									
										
										
										
											2017-10-30 20:56:57 +08:00
										 |  |  | 		this.set("output.webassemblyModuleFilename", "[modulehash].module.wasm"); | 
					
						
							| 
									
										
										
										
											2017-01-03 00:45:44 +08:00
										 |  |  | 		this.set("output.library", ""); | 
					
						
							| 
									
										
										
										
											2017-12-31 08:42:01 +08:00
										 |  |  | 		this.set("output.hotUpdateFunction", "make", options => { | 
					
						
							| 
									
										
										
										
											2017-12-28 01:46:37 +08:00
										 |  |  | 			return Template.toIdentifier("webpackHotUpdate" + Template.toIdentifier(options.output.library)); | 
					
						
							| 
									
										
										
										
											2017-01-03 00:45:44 +08:00
										 |  |  | 		}); | 
					
						
							| 
									
										
										
										
											2017-12-31 08:42:01 +08:00
										 |  |  | 		this.set("output.jsonpFunction", "make", options => { | 
					
						
							| 
									
										
										
										
											2017-11-21 17:41:01 +08:00
										 |  |  | 			return Template.toIdentifier("webpackJsonp" + Template.toIdentifier(options.output.library)); | 
					
						
							| 
									
										
										
										
											2017-01-03 00:45:44 +08:00
										 |  |  | 		}); | 
					
						
							| 
									
										
										
										
											2018-01-03 22:41:45 +08:00
										 |  |  | 		this.set("output.chunkCallbackName", "make", options => { | 
					
						
							| 
									
										
										
										
											2017-12-28 01:46:37 +08:00
										 |  |  | 			return Template.toIdentifier("webpackChunk" + Template.toIdentifier(options.output.library)); | 
					
						
							|  |  |  | 		}); | 
					
						
							|  |  |  | 		this.set("output.globalObject", "make", options => { | 
					
						
							|  |  |  | 			switch(options.target) { | 
					
						
							|  |  |  | 				case "web": | 
					
						
							|  |  |  | 				case "electron-renderer": | 
					
						
							|  |  |  | 					return "window"; | 
					
						
							|  |  |  | 				case "webworker": | 
					
						
							|  |  |  | 					return "self"; | 
					
						
							|  |  |  | 				case "node": | 
					
						
							|  |  |  | 				case "async-node": | 
					
						
							|  |  |  | 				case "node-webkit": | 
					
						
							|  |  |  | 				case "electron-main": | 
					
						
							|  |  |  | 					return "global"; | 
					
						
							|  |  |  | 				default: | 
					
						
							|  |  |  | 					return "self"; | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		}); | 
					
						
							| 
									
										
										
										
											2017-12-31 08:42:01 +08:00
										 |  |  | 		this.set("output.devtoolNamespace", "make", options => { | 
					
						
							| 
									
										
										
										
											2017-10-20 04:23:28 +08:00
										 |  |  | 			return options.output.library || ""; | 
					
						
							|  |  |  | 		}); | 
					
						
							| 
									
										
										
										
											2017-01-03 00:45:44 +08:00
										 |  |  | 		this.set("output.libraryTarget", "var"); | 
					
						
							| 
									
										
										
										
											2017-12-19 04:18:07 +08:00
										 |  |  | 		this.set("output.path", path.join(process.cwd(), "dist")); | 
					
						
							| 
									
										
										
										
											2017-11-21 17:41:01 +08:00
										 |  |  | 		this.set("output.pathinfo", "make", options => options.mode === "development"); | 
					
						
							| 
									
										
										
										
											2017-01-03 00:45:44 +08:00
										 |  |  | 		this.set("output.sourceMapFilename", "[file].map[query]"); | 
					
						
							|  |  |  | 		this.set("output.hotUpdateChunkFilename", "[id].[hash].hot-update.js"); | 
					
						
							|  |  |  | 		this.set("output.hotUpdateMainFilename", "[hash].hot-update.json"); | 
					
						
							|  |  |  | 		this.set("output.crossOriginLoading", false); | 
					
						
							| 
									
										
										
										
											2018-01-05 03:34:59 +08:00
										 |  |  | 		this.set("output.jsonpScriptType", false); | 
					
						
							| 
									
										
										
										
											2017-05-11 16:41:38 +08:00
										 |  |  | 		this.set("output.chunkLoadTimeout", 120000); | 
					
						
							| 
									
										
										
										
											2017-01-03 00:45:44 +08:00
										 |  |  | 		this.set("output.hashFunction", "md5"); | 
					
						
							|  |  |  | 		this.set("output.hashDigest", "hex"); | 
					
						
							|  |  |  | 		this.set("output.hashDigestLength", 20); | 
					
						
							|  |  |  | 		this.set("output.devtoolLineToLine", false); | 
					
						
							|  |  |  | 		this.set("output.strictModuleExceptionHandling", false); | 
					
						
							| 
									
										
										
										
											2013-02-26 20:31:05 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-06 23:15:03 +08:00
										 |  |  | 		this.set("node", "call", value => { | 
					
						
							|  |  |  | 			if(typeof value === "boolean") { | 
					
						
							|  |  |  | 				return value; | 
					
						
							|  |  |  | 			} else { | 
					
						
							|  |  |  | 				return Object.assign({}, value); | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		}); | 
					
						
							| 
									
										
										
										
											2017-01-03 00:45:44 +08:00
										 |  |  | 		this.set("node.console", false); | 
					
						
							|  |  |  | 		this.set("node.process", true); | 
					
						
							|  |  |  | 		this.set("node.global", true); | 
					
						
							|  |  |  | 		this.set("node.Buffer", true); | 
					
						
							|  |  |  | 		this.set("node.setImmediate", true); | 
					
						
							|  |  |  | 		this.set("node.__filename", "mock"); | 
					
						
							|  |  |  | 		this.set("node.__dirname", "mock"); | 
					
						
							| 
									
										
										
										
											2016-12-03 04:49:42 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-03 23:26:55 +08:00
										 |  |  | 		this.set("performance", "make", options => (isProductionLikeMode(options) ? false : undefined)); | 
					
						
							| 
									
										
										
										
											2017-09-06 23:15:03 +08:00
										 |  |  | 		this.set("performance", "call", value => { | 
					
						
							|  |  |  | 			if(typeof value === "boolean") { | 
					
						
							|  |  |  | 				return value; | 
					
						
							|  |  |  | 			} else { | 
					
						
							|  |  |  | 				return Object.assign({}, value); | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		}); | 
					
						
							| 
									
										
										
										
											2017-01-03 00:45:44 +08:00
										 |  |  | 		this.set("performance.maxAssetSize", 250000); | 
					
						
							|  |  |  | 		this.set("performance.maxEntrypointSize", 250000); | 
					
						
							| 
									
										
										
										
											2017-12-31 08:42:01 +08:00
										 |  |  | 		this.set("performance.hints", "make", options => (isProductionLikeMode(options) ? "warning" : false)); | 
					
						
							| 
									
										
										
										
											2017-11-21 17:41:01 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		this.set("optimization.removeAvailableModules", true); | 
					
						
							|  |  |  | 		this.set("optimization.removeEmptyChunks", true); | 
					
						
							| 
									
										
										
										
											2018-02-13 19:38:10 +08:00
										 |  |  | 		this.set("optimization.mergeDuplicateChunks", true); | 
					
						
							| 
									
										
										
										
											2017-12-31 08:42:01 +08:00
										 |  |  | 		this.set("optimization.flagIncludedChunks", "make", options => isProductionLikeMode(options)); | 
					
						
							|  |  |  | 		this.set("optimization.occurrenceOrder", "make", options => isProductionLikeMode(options)); | 
					
						
							|  |  |  | 		this.set("optimization.sideEffects", "make", options => isProductionLikeMode(options)); | 
					
						
							| 
									
										
										
										
											2017-11-21 17:41:01 +08:00
										 |  |  | 		this.set("optimization.providedExports", true); | 
					
						
							| 
									
										
										
										
											2017-12-31 08:42:01 +08:00
										 |  |  | 		this.set("optimization.usedExports", "make", options => isProductionLikeMode(options)); | 
					
						
							|  |  |  | 		this.set("optimization.concatenateModules", "make", options => isProductionLikeMode(options)); | 
					
						
							| 
									
										
										
										
											2018-01-20 00:06:59 +08:00
										 |  |  | 		this.set("optimization.splitChunks", {}); | 
					
						
							| 
									
										
										
										
											2018-02-16 16:12:01 +08:00
										 |  |  | 		this.set("optimization.splitChunks.maxComplexity", "make", options => isProductionLikeMode(options) ? 3 : 1); | 
					
						
							| 
									
										
										
										
											2018-01-20 00:06:59 +08:00
										 |  |  | 		this.set("optimization.splitChunks.chunks", "async"); | 
					
						
							|  |  |  | 		this.set("optimization.splitChunks.minSize", 30000); | 
					
						
							|  |  |  | 		this.set("optimization.splitChunks.minChunks", 1); | 
					
						
							|  |  |  | 		this.set("optimization.splitChunks.maxAsyncRequests", 5); | 
					
						
							|  |  |  | 		this.set("optimization.splitChunks.maxInitialRequests", 3); | 
					
						
							|  |  |  | 		this.set("optimization.splitChunks.name", true); | 
					
						
							| 
									
										
										
										
											2018-01-20 20:11:02 +08:00
										 |  |  | 		this.set("optimization.splitChunks.cacheGroups", {}); | 
					
						
							|  |  |  | 		this.set("optimization.splitChunks.cacheGroups.default", { | 
					
						
							|  |  |  | 			reuseExistingChunk: true, | 
					
						
							|  |  |  | 			minChunks: 2, | 
					
						
							|  |  |  | 			priority: -20 | 
					
						
							|  |  |  | 		}); | 
					
						
							|  |  |  | 		this.set("optimization.splitChunks.cacheGroups.vendors", { | 
					
						
							|  |  |  | 			test: /[\\/]node_modules[\\/]/, | 
					
						
							|  |  |  | 			priority: -10 | 
					
						
							| 
									
										
										
										
											2018-01-20 00:06:59 +08:00
										 |  |  | 		}); | 
					
						
							| 
									
										
										
										
											2018-02-02 00:50:03 +08:00
										 |  |  | 		this.set("optimization.runtimeChunk", "call", value => { | 
					
						
							|  |  |  | 			if(value === "single") { | 
					
						
							|  |  |  | 				return { | 
					
						
							|  |  |  | 					name: "runtime" | 
					
						
							|  |  |  | 				}; | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2018-02-02 01:08:57 +08:00
										 |  |  | 			if(value === true || value === "multiple") { | 
					
						
							| 
									
										
										
										
											2018-02-02 00:50:03 +08:00
										 |  |  | 				return { | 
					
						
							|  |  |  | 					name: entrypoint => `runtime~${entrypoint.name}` | 
					
						
							|  |  |  | 				}; | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			return value; | 
					
						
							|  |  |  | 		}); | 
					
						
							| 
									
										
										
										
											2017-12-31 08:42:01 +08:00
										 |  |  | 		this.set("optimization.noEmitOnErrors", "make", options => isProductionLikeMode(options)); | 
					
						
							| 
									
										
										
										
											2017-11-21 17:41:01 +08:00
										 |  |  | 		this.set("optimization.namedModules", "make", options => options.mode === "development"); | 
					
						
							|  |  |  | 		this.set("optimization.namedChunks", "make", options => options.mode === "development"); | 
					
						
							| 
									
										
										
										
											2017-12-01 16:49:07 +08:00
										 |  |  | 		this.set("optimization.portableRecords", "make", options => !!(options.recordsInputPath || options.recordsOutputPath || options.recordsPath)); | 
					
						
							| 
									
										
										
										
											2017-12-31 08:42:01 +08:00
										 |  |  | 		this.set("optimization.minimize", "make", options => isProductionLikeMode(options)); | 
					
						
							| 
									
										
										
										
											2017-12-13 23:05:21 +08:00
										 |  |  | 		this.set("optimization.minimizer", "make", options => [{ | 
					
						
							|  |  |  | 			apply: compiler => { | 
					
						
							|  |  |  | 				// Lazy load the uglifyjs plugin
 | 
					
						
							|  |  |  | 				const UglifyJsPlugin = require("uglifyjs-webpack-plugin"); | 
					
						
							|  |  |  | 				new UglifyJsPlugin({ | 
					
						
							| 
									
										
										
										
											2017-12-17 22:48:01 +08:00
										 |  |  | 					cache: true, | 
					
						
							| 
									
										
										
										
											2017-12-18 14:49:48 +08:00
										 |  |  | 					parallel: true, | 
					
						
							| 
									
										
										
										
											2017-12-13 23:05:21 +08:00
										 |  |  | 					sourceMap: options.devtool && /source-?map/.test(options.devtool) | 
					
						
							|  |  |  | 				}).apply(compiler); | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		}]); | 
					
						
							| 
									
										
										
										
											2018-02-14 05:17:55 +08:00
										 |  |  | 		this.set("optimization.nodeEnv", "make", options => options.mode || "production"); | 
					
						
							| 
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-06 18:10:16 +08:00
										 |  |  | 		this.set("resolve", "call", value => Object.assign({}, value)); | 
					
						
							| 
									
										
										
										
											2017-01-03 00:45:44 +08:00
										 |  |  | 		this.set("resolve.unsafeCache", true); | 
					
						
							|  |  |  | 		this.set("resolve.modules", ["node_modules"]); | 
					
						
							| 
									
										
										
										
											2017-11-23 04:37:26 +08:00
										 |  |  | 		this.set("resolve.extensions", [".wasm", ".mjs", ".js", ".json"]); | 
					
						
							| 
									
										
										
										
											2017-06-02 19:41:25 +08:00
										 |  |  | 		this.set("resolve.mainFiles", ["index"]); | 
					
						
							| 
									
										
										
										
											2017-12-31 08:42:01 +08:00
										 |  |  | 		this.set("resolve.aliasFields", "make", options => { | 
					
						
							|  |  |  | 			if(options.target === "web" || options.target === "webworker") return ["browser"]; | 
					
						
							|  |  |  | 			else return []; | 
					
						
							| 
									
										
										
										
											2017-01-03 00:45:44 +08:00
										 |  |  | 		}); | 
					
						
							| 
									
										
										
										
											2017-12-31 08:42:01 +08:00
										 |  |  | 		this.set("resolve.mainFields", "make", options => { | 
					
						
							|  |  |  | 			if(options.target === "web" || options.target === "webworker") return ["browser", "module", "main"]; | 
					
						
							|  |  |  | 			else return ["module", "main"]; | 
					
						
							| 
									
										
										
										
											2017-01-03 00:45:44 +08:00
										 |  |  | 		}); | 
					
						
							| 
									
										
										
										
											2017-12-31 08:42:01 +08:00
										 |  |  | 		this.set("resolve.cacheWithContext", "make", options => { | 
					
						
							| 
									
										
										
										
											2017-06-28 20:37:58 +08:00
										 |  |  | 			return Array.isArray(options.resolve.plugins) && options.resolve.plugins.length > 0; | 
					
						
							|  |  |  | 		}); | 
					
						
							| 
									
										
										
										
											2017-09-06 18:10:16 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		this.set("resolveLoader", "call", value => Object.assign({}, value)); | 
					
						
							| 
									
										
										
										
											2017-01-03 00:45:44 +08:00
										 |  |  | 		this.set("resolveLoader.unsafeCache", true); | 
					
						
							|  |  |  | 		this.set("resolveLoader.mainFields", ["loader", "main"]); | 
					
						
							|  |  |  | 		this.set("resolveLoader.extensions", [".js", ".json"]); | 
					
						
							| 
									
										
										
										
											2017-06-02 19:41:25 +08:00
										 |  |  | 		this.set("resolveLoader.mainFiles", ["index"]); | 
					
						
							| 
									
										
										
										
											2017-12-31 08:42:01 +08:00
										 |  |  | 		this.set("resolveLoader.cacheWithContext", "make", options => { | 
					
						
							| 
									
										
										
										
											2017-06-28 20:37:58 +08:00
										 |  |  | 			return Array.isArray(options.resolveLoader.plugins) && options.resolveLoader.plugins.length > 0; | 
					
						
							|  |  |  | 		}); | 
					
						
							| 
									
										
										
										
											2017-01-03 00:45:44 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2014-02-13 18:02:31 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-03 00:45:44 +08:00
										 |  |  | module.exports = WebpackOptionsDefaulter; |