| 1 | /*
|
|---|
| 2 | MIT License http://www.opensource.org/licenses/mit-license.php
|
|---|
| 3 | Author Tobias Koppers @sokra
|
|---|
| 4 | */
|
|---|
| 5 |
|
|---|
| 6 | "use strict";
|
|---|
| 7 |
|
|---|
| 8 | const util = require("util");
|
|---|
| 9 | const memoize = require("./util/memoize");
|
|---|
| 10 |
|
|---|
| 11 | /** @typedef {import("../declarations/WebpackOptions").Entry} Entry */
|
|---|
| 12 | /** @typedef {import("../declarations/WebpackOptions").EntryNormalized} EntryNormalized */
|
|---|
| 13 | /** @typedef {import("../declarations/WebpackOptions").EntryObject} EntryObject */
|
|---|
| 14 | /** @typedef {import("../declarations/WebpackOptions").ExternalItem} ExternalItem */
|
|---|
| 15 | /** @typedef {import("../declarations/WebpackOptions").ExternalItemFunction} ExternalItemFunction */
|
|---|
| 16 | /** @typedef {import("../declarations/WebpackOptions").ExternalItemObjectKnown} ExternalItemObjectKnown */
|
|---|
| 17 | /** @typedef {import("../declarations/WebpackOptions").ExternalItemObjectUnknown} ExternalItemObjectUnknown */
|
|---|
| 18 | /** @typedef {import("../declarations/WebpackOptions").ExternalItemValue} ExternalItemValue */
|
|---|
| 19 | /** @typedef {import("../declarations/WebpackOptions").Externals} Externals */
|
|---|
| 20 | /** @typedef {import("../declarations/WebpackOptions").FileCacheOptions} FileCacheOptions */
|
|---|
| 21 | /** @typedef {import("../declarations/WebpackOptions").GeneratorOptionsByModuleTypeKnown} GeneratorOptionsByModuleTypeKnown */
|
|---|
| 22 | /** @typedef {import("../declarations/WebpackOptions").LibraryOptions} LibraryOptions */
|
|---|
| 23 | /** @typedef {import("../declarations/WebpackOptions").MemoryCacheOptions} MemoryCacheOptions */
|
|---|
| 24 | /** @typedef {import("../declarations/WebpackOptions").ModuleOptions} ModuleOptions */
|
|---|
| 25 | /** @typedef {import("../declarations/WebpackOptions").ParserOptionsByModuleTypeKnown} ParserOptionsByModuleTypeKnown */
|
|---|
| 26 | /** @typedef {import("../declarations/WebpackOptions").ResolveOptions} ResolveOptions */
|
|---|
| 27 | /** @typedef {import("../declarations/WebpackOptions").RuleSetCondition} RuleSetCondition */
|
|---|
| 28 | /** @typedef {import("../declarations/WebpackOptions").RuleSetConditionAbsolute} RuleSetConditionAbsolute */
|
|---|
| 29 | /** @typedef {import("../declarations/WebpackOptions").RuleSetRule} RuleSetRule */
|
|---|
| 30 | /** @typedef {import("../declarations/WebpackOptions").RuleSetUse} RuleSetUse */
|
|---|
| 31 | /** @typedef {import("../declarations/WebpackOptions").RuleSetUseFunction} RuleSetUseFunction */
|
|---|
| 32 | /** @typedef {import("../declarations/WebpackOptions").RuleSetUseItem} RuleSetUseItem */
|
|---|
| 33 | /** @typedef {import("../declarations/WebpackOptions").StatsOptions} StatsOptions */
|
|---|
| 34 | /** @typedef {import("../declarations/WebpackOptions").WebpackOptions} Configuration */
|
|---|
| 35 | /** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptionsNormalized */
|
|---|
| 36 | /** @typedef {import("../declarations/WebpackOptions").WebpackPluginFunction} WebpackPluginFunction */
|
|---|
| 37 | /** @typedef {import("../declarations/WebpackOptions").WebpackPluginInstance} WebpackPluginInstance */
|
|---|
| 38 | /** @typedef {import("./ChunkGroup")} ChunkGroup */
|
|---|
| 39 | /** @typedef {import("./Compiler").AssetEmittedInfo} AssetEmittedInfo */
|
|---|
| 40 | /** @typedef {import("./Compilation").Asset} Asset */
|
|---|
| 41 | /** @typedef {import("./Compilation").AssetInfo} AssetInfo */
|
|---|
| 42 | /** @typedef {import("./Compilation").EntryOptions} EntryOptions */
|
|---|
| 43 | /** @typedef {import("./Compilation").PathData} PathData */
|
|---|
| 44 | /** @typedef {import("./Compilation").PathDataChunk} PathDataChunk */
|
|---|
| 45 | /** @typedef {import("./Compilation").PathDataModule} PathDataModule */
|
|---|
| 46 | /** @typedef {import("./CodeGenerationResults")} CodeGenerationResults */
|
|---|
| 47 | /** @typedef {import("./Entrypoint")} Entrypoint */
|
|---|
| 48 | /** @typedef {import("./ExternalModuleFactoryPlugin").ExternalItemFunctionCallback} ExternalItemFunctionCallback */
|
|---|
| 49 | /** @typedef {import("./ExternalModuleFactoryPlugin").ExternalItemFunctionData} ExternalItemFunctionData */
|
|---|
| 50 | /** @typedef {import("./ExternalModuleFactoryPlugin").ExternalItemFunctionDataGetResolve} ExternalItemFunctionDataGetResolve */
|
|---|
| 51 | /** @typedef {import("./ExternalModuleFactoryPlugin").ExternalItemFunctionDataGetResolveCallbackResult} ExternalItemFunctionDataGetResolveCallbackResult */
|
|---|
| 52 | /** @typedef {import("./ExternalModuleFactoryPlugin").ExternalItemFunctionDataGetResolveResult} ExternalItemFunctionDataGetResolveResult */
|
|---|
| 53 | /** @typedef {import("./ExternalModuleFactoryPlugin").ExternalItemFunctionPromise} ExternalItemFunctionPromise */
|
|---|
| 54 | /** @typedef {import("./MultiCompiler").MultiCompilerOptions} MultiCompilerOptions */
|
|---|
| 55 | /** @typedef {import("./MultiCompiler").MultiWebpackOptions} MultiConfiguration */
|
|---|
| 56 | /** @typedef {import("./MultiStats")} MultiStats */
|
|---|
| 57 | /** @typedef {import("./MultiStats").MultiStatsOptions} MultiStatsOptions */
|
|---|
| 58 | /** @typedef {import("./NormalModuleFactory").ResolveData} ResolveData */
|
|---|
| 59 | /** @typedef {import("./Parser").ParserState} ParserState */
|
|---|
| 60 | /** @typedef {import("./ResolverFactory").ResolvePluginInstance} ResolvePluginInstance */
|
|---|
| 61 | /** @typedef {import("./ResolverFactory").Resolver} Resolver */
|
|---|
| 62 | /** @typedef {import("./Template").RenderManifestEntry} RenderManifestEntry */
|
|---|
| 63 | /** @typedef {import("./Template").RenderManifestOptions} RenderManifestOptions */
|
|---|
| 64 | /** @typedef {import("./TemplatedPathPlugin").TemplatePath} TemplatePath */
|
|---|
| 65 | /** @typedef {import("./Watching")} Watching */
|
|---|
| 66 | /** @typedef {import("./cli").Argument} Argument */
|
|---|
| 67 | /** @typedef {import("./cli").Problem} Problem */
|
|---|
| 68 | /** @typedef {import("./cli").Colors} Colors */
|
|---|
| 69 | /** @typedef {import("./cli").ColorsOptions} ColorsOptions */
|
|---|
| 70 | /** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsAsset} StatsAsset */
|
|---|
| 71 | /** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsChunk} StatsChunk */
|
|---|
| 72 | /** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsChunkGroup} StatsChunkGroup */
|
|---|
| 73 | /** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsChunkOrigin} StatsChunkOrigin */
|
|---|
| 74 | /** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsCompilation} StatsCompilation */
|
|---|
| 75 | /** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsError} StatsError */
|
|---|
| 76 | /** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsLogging} StatsLogging */
|
|---|
| 77 | /** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsLoggingEntry} StatsLoggingEntry */
|
|---|
| 78 | /** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsModule} StatsModule */
|
|---|
| 79 | /** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsModuleIssuer} StatsModuleIssuer */
|
|---|
| 80 | /** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsModuleReason} StatsModuleReason */
|
|---|
| 81 | /** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsModuleTraceDependency} StatsModuleTraceDependency */
|
|---|
| 82 | /** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsModuleTraceItem} StatsModuleTraceItem */
|
|---|
| 83 | /** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsProfile} StatsProfile */
|
|---|
| 84 | /** @typedef {import("./serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
|
|---|
| 85 | /** @typedef {import("./serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
|
|---|
| 86 | /** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */
|
|---|
| 87 | /** @typedef {import("./util/fs").OutputFileSystem} OutputFileSystem */
|
|---|
| 88 |
|
|---|
| 89 | /**
|
|---|
| 90 | * Returns function.
|
|---|
| 91 | * @template {EXPECTED_FUNCTION} T
|
|---|
| 92 | * @param {() => T} factory factory function
|
|---|
| 93 | * @returns {T} function
|
|---|
| 94 | */
|
|---|
| 95 | const lazyFunction = (factory) => {
|
|---|
| 96 | const fac = memoize(factory);
|
|---|
| 97 | const f = /** @type {unknown} */ (
|
|---|
| 98 | /**
|
|---|
| 99 | * Handles the callback logic for this hook.
|
|---|
| 100 | * @param {...EXPECTED_ANY} args args
|
|---|
| 101 | * @returns {T} result
|
|---|
| 102 | */
|
|---|
| 103 | (...args) => fac()(...args)
|
|---|
| 104 | );
|
|---|
| 105 | return /** @type {T} */ (f);
|
|---|
| 106 | };
|
|---|
| 107 |
|
|---|
| 108 | /**
|
|---|
| 109 | * Merges the provided values into a single result.
|
|---|
| 110 | * @template A
|
|---|
| 111 | * @template B
|
|---|
| 112 | * @param {A} obj input a
|
|---|
| 113 | * @param {B} exports input b
|
|---|
| 114 | * @returns {A & B} merged
|
|---|
| 115 | */
|
|---|
| 116 | const mergeExports = (obj, exports) => {
|
|---|
| 117 | const descriptors = Object.getOwnPropertyDescriptors(exports);
|
|---|
| 118 | for (const name of Object.keys(descriptors)) {
|
|---|
| 119 | const descriptor = descriptors[name];
|
|---|
| 120 | if (descriptor.get) {
|
|---|
| 121 | const fn = descriptor.get;
|
|---|
| 122 | Object.defineProperty(obj, name, {
|
|---|
| 123 | configurable: false,
|
|---|
| 124 | enumerable: true,
|
|---|
| 125 | get: memoize(fn)
|
|---|
| 126 | });
|
|---|
| 127 | } else if (typeof descriptor.value === "object") {
|
|---|
| 128 | Object.defineProperty(obj, name, {
|
|---|
| 129 | configurable: false,
|
|---|
| 130 | enumerable: true,
|
|---|
| 131 | writable: false,
|
|---|
| 132 | value: mergeExports({}, descriptor.value)
|
|---|
| 133 | });
|
|---|
| 134 | } else {
|
|---|
| 135 | throw new Error(
|
|---|
| 136 | "Exposed values must be either a getter or an nested object"
|
|---|
| 137 | );
|
|---|
| 138 | }
|
|---|
| 139 | }
|
|---|
| 140 | return /** @type {A & B} */ (Object.freeze(obj));
|
|---|
| 141 | };
|
|---|
| 142 |
|
|---|
| 143 | const fn = lazyFunction(() => require("./webpack"));
|
|---|
| 144 |
|
|---|
| 145 | module.exports = mergeExports(fn, {
|
|---|
| 146 | get webpack() {
|
|---|
| 147 | return require("./webpack");
|
|---|
| 148 | },
|
|---|
| 149 | /**
|
|---|
| 150 | * Returns validate fn.
|
|---|
| 151 | * @returns {(configuration: Configuration | MultiConfiguration) => void} validate fn
|
|---|
| 152 | */
|
|---|
| 153 | get validate() {
|
|---|
| 154 | const webpackOptionsSchemaCheck =
|
|---|
| 155 | /** @type {(configuration: Configuration | MultiConfiguration) => boolean} */
|
|---|
| 156 | (require("../schemas/WebpackOptions.check"));
|
|---|
| 157 |
|
|---|
| 158 | const getRealValidate = memoize(
|
|---|
| 159 | /**
|
|---|
| 160 | * Handles the callback logic for this hook.
|
|---|
| 161 | * @returns {(configuration: Configuration | MultiConfiguration) => void} validate fn
|
|---|
| 162 | */
|
|---|
| 163 | () => {
|
|---|
| 164 | const validateSchema = require("./validateSchema");
|
|---|
| 165 | const webpackOptionsSchema =
|
|---|
| 166 | /** @type {EXPECTED_ANY} */
|
|---|
| 167 | (require("../schemas/WebpackOptions.json"));
|
|---|
| 168 |
|
|---|
| 169 | return (options) => validateSchema(webpackOptionsSchema, options);
|
|---|
| 170 | }
|
|---|
| 171 | );
|
|---|
| 172 | return (options) => {
|
|---|
| 173 | if (!webpackOptionsSchemaCheck(options)) {
|
|---|
| 174 | getRealValidate()(options);
|
|---|
| 175 | }
|
|---|
| 176 | };
|
|---|
| 177 | },
|
|---|
| 178 | get validateSchema() {
|
|---|
| 179 | const validateSchema = require("./validateSchema");
|
|---|
| 180 |
|
|---|
| 181 | return validateSchema;
|
|---|
| 182 | },
|
|---|
| 183 | get version() {
|
|---|
| 184 | return /** @type {string} */ (require("../package.json").version);
|
|---|
| 185 | },
|
|---|
| 186 |
|
|---|
| 187 | get cli() {
|
|---|
| 188 | return require("./cli");
|
|---|
| 189 | },
|
|---|
| 190 | get AutomaticPrefetchPlugin() {
|
|---|
| 191 | return require("./AutomaticPrefetchPlugin");
|
|---|
| 192 | },
|
|---|
| 193 | get AsyncDependenciesBlock() {
|
|---|
| 194 | return require("./AsyncDependenciesBlock");
|
|---|
| 195 | },
|
|---|
| 196 | get BannerPlugin() {
|
|---|
| 197 | return require("./BannerPlugin");
|
|---|
| 198 | },
|
|---|
| 199 | get Cache() {
|
|---|
| 200 | return require("./Cache");
|
|---|
| 201 | },
|
|---|
| 202 | get Chunk() {
|
|---|
| 203 | return require("./Chunk");
|
|---|
| 204 | },
|
|---|
| 205 | get ChunkGraph() {
|
|---|
| 206 | return require("./ChunkGraph");
|
|---|
| 207 | },
|
|---|
| 208 | get CleanPlugin() {
|
|---|
| 209 | return require("./CleanPlugin");
|
|---|
| 210 | },
|
|---|
| 211 | get Compilation() {
|
|---|
| 212 | return require("./Compilation");
|
|---|
| 213 | },
|
|---|
| 214 | get Compiler() {
|
|---|
| 215 | return require("./Compiler");
|
|---|
| 216 | },
|
|---|
| 217 | get ConcatenationScope() {
|
|---|
| 218 | return require("./ConcatenationScope");
|
|---|
| 219 | },
|
|---|
| 220 | get ContextExclusionPlugin() {
|
|---|
| 221 | return require("./ContextExclusionPlugin");
|
|---|
| 222 | },
|
|---|
| 223 | get ContextReplacementPlugin() {
|
|---|
| 224 | return require("./ContextReplacementPlugin");
|
|---|
| 225 | },
|
|---|
| 226 | get DefinePlugin() {
|
|---|
| 227 | return require("./DefinePlugin");
|
|---|
| 228 | },
|
|---|
| 229 | get Dependency() {
|
|---|
| 230 | return require("./Dependency");
|
|---|
| 231 | },
|
|---|
| 232 | get DynamicEntryPlugin() {
|
|---|
| 233 | return require("./DynamicEntryPlugin");
|
|---|
| 234 | },
|
|---|
| 235 | get DotenvPlugin() {
|
|---|
| 236 | return require("./DotenvPlugin");
|
|---|
| 237 | },
|
|---|
| 238 | get EntryOptionPlugin() {
|
|---|
| 239 | return require("./EntryOptionPlugin");
|
|---|
| 240 | },
|
|---|
| 241 | get EntryPlugin() {
|
|---|
| 242 | return require("./EntryPlugin");
|
|---|
| 243 | },
|
|---|
| 244 | get EnvironmentPlugin() {
|
|---|
| 245 | return require("./EnvironmentPlugin");
|
|---|
| 246 | },
|
|---|
| 247 | get EvalDevToolModulePlugin() {
|
|---|
| 248 | return require("./EvalDevToolModulePlugin");
|
|---|
| 249 | },
|
|---|
| 250 | get EvalSourceMapDevToolPlugin() {
|
|---|
| 251 | return require("./EvalSourceMapDevToolPlugin");
|
|---|
| 252 | },
|
|---|
| 253 | get ExternalModule() {
|
|---|
| 254 | return require("./ExternalModule");
|
|---|
| 255 | },
|
|---|
| 256 | get ExternalsPlugin() {
|
|---|
| 257 | return require("./ExternalsPlugin");
|
|---|
| 258 | },
|
|---|
| 259 | get Generator() {
|
|---|
| 260 | return require("./Generator");
|
|---|
| 261 | },
|
|---|
| 262 | get HotUpdateChunk() {
|
|---|
| 263 | return require("./HotUpdateChunk");
|
|---|
| 264 | },
|
|---|
| 265 | get HotModuleReplacementPlugin() {
|
|---|
| 266 | return require("./HotModuleReplacementPlugin");
|
|---|
| 267 | },
|
|---|
| 268 | get InitFragment() {
|
|---|
| 269 | return require("./InitFragment");
|
|---|
| 270 | },
|
|---|
| 271 | get IgnorePlugin() {
|
|---|
| 272 | return require("./IgnorePlugin");
|
|---|
| 273 | },
|
|---|
| 274 | get JavascriptModulesPlugin() {
|
|---|
| 275 | return util.deprecate(
|
|---|
| 276 | () => require("./javascript/JavascriptModulesPlugin"),
|
|---|
| 277 | "webpack.JavascriptModulesPlugin has moved to webpack.javascript.JavascriptModulesPlugin",
|
|---|
| 278 | "DEP_WEBPACK_JAVASCRIPT_MODULES_PLUGIN"
|
|---|
| 279 | )();
|
|---|
| 280 | },
|
|---|
| 281 | get LibraryTemplatePlugin() {
|
|---|
| 282 | return util.deprecate(
|
|---|
| 283 | () => require("./LibraryTemplatePlugin"),
|
|---|
| 284 | "webpack.LibraryTemplatePlugin is deprecated and has been replaced by compilation.outputOptions.library or compilation.addEntry + passing a library option",
|
|---|
| 285 | "DEP_WEBPACK_LIBRARY_TEMPLATE_PLUGIN"
|
|---|
| 286 | )();
|
|---|
| 287 | },
|
|---|
| 288 | get LoaderOptionsPlugin() {
|
|---|
| 289 | return require("./LoaderOptionsPlugin");
|
|---|
| 290 | },
|
|---|
| 291 | get LoaderTargetPlugin() {
|
|---|
| 292 | return require("./LoaderTargetPlugin");
|
|---|
| 293 | },
|
|---|
| 294 | get Module() {
|
|---|
| 295 | return require("./Module");
|
|---|
| 296 | },
|
|---|
| 297 | get ModuleFactory() {
|
|---|
| 298 | return require("./ModuleFactory");
|
|---|
| 299 | },
|
|---|
| 300 | get ModuleFilenameHelpers() {
|
|---|
| 301 | return require("./ModuleFilenameHelpers");
|
|---|
| 302 | },
|
|---|
| 303 | get ModuleGraph() {
|
|---|
| 304 | return require("./ModuleGraph");
|
|---|
| 305 | },
|
|---|
| 306 | get ModuleGraphConnection() {
|
|---|
| 307 | return require("./ModuleGraphConnection");
|
|---|
| 308 | },
|
|---|
| 309 | get NoEmitOnErrorsPlugin() {
|
|---|
| 310 | return require("./NoEmitOnErrorsPlugin");
|
|---|
| 311 | },
|
|---|
| 312 | get NormalModule() {
|
|---|
| 313 | return require("./NormalModule");
|
|---|
| 314 | },
|
|---|
| 315 | get NormalModuleReplacementPlugin() {
|
|---|
| 316 | return require("./NormalModuleReplacementPlugin");
|
|---|
| 317 | },
|
|---|
| 318 | get MultiCompiler() {
|
|---|
| 319 | return require("./MultiCompiler");
|
|---|
| 320 | },
|
|---|
| 321 | get OptimizationStages() {
|
|---|
| 322 | return require("./OptimizationStages");
|
|---|
| 323 | },
|
|---|
| 324 | get Parser() {
|
|---|
| 325 | return require("./Parser");
|
|---|
| 326 | },
|
|---|
| 327 | get PlatformPlugin() {
|
|---|
| 328 | return require("./PlatformPlugin");
|
|---|
| 329 | },
|
|---|
| 330 | get PrefetchPlugin() {
|
|---|
| 331 | return require("./PrefetchPlugin");
|
|---|
| 332 | },
|
|---|
| 333 | get ProgressPlugin() {
|
|---|
| 334 | return require("./ProgressPlugin");
|
|---|
| 335 | },
|
|---|
| 336 | get ProvidePlugin() {
|
|---|
| 337 | return require("./ProvidePlugin");
|
|---|
| 338 | },
|
|---|
| 339 | get RuntimeGlobals() {
|
|---|
| 340 | return require("./RuntimeGlobals");
|
|---|
| 341 | },
|
|---|
| 342 | get RuntimeModule() {
|
|---|
| 343 | return require("./RuntimeModule");
|
|---|
| 344 | },
|
|---|
| 345 | get SingleEntryPlugin() {
|
|---|
| 346 | return util.deprecate(
|
|---|
| 347 | () => require("./EntryPlugin"),
|
|---|
| 348 | "SingleEntryPlugin was renamed to EntryPlugin",
|
|---|
| 349 | "DEP_WEBPACK_SINGLE_ENTRY_PLUGIN"
|
|---|
| 350 | )();
|
|---|
| 351 | },
|
|---|
| 352 | get SourceMapDevToolPlugin() {
|
|---|
| 353 | return require("./SourceMapDevToolPlugin");
|
|---|
| 354 | },
|
|---|
| 355 | get Stats() {
|
|---|
| 356 | return require("./Stats");
|
|---|
| 357 | },
|
|---|
| 358 | get ManifestPlugin() {
|
|---|
| 359 | return require("./ManifestPlugin");
|
|---|
| 360 | },
|
|---|
| 361 | get Template() {
|
|---|
| 362 | return require("./Template");
|
|---|
| 363 | },
|
|---|
| 364 | get UsageState() {
|
|---|
| 365 | return require("./ExportsInfo").UsageState;
|
|---|
| 366 | },
|
|---|
| 367 | get WatchIgnorePlugin() {
|
|---|
| 368 | return require("./WatchIgnorePlugin");
|
|---|
| 369 | },
|
|---|
| 370 | get WebpackError() {
|
|---|
| 371 | return require("./errors/WebpackError");
|
|---|
| 372 | },
|
|---|
| 373 | get WebpackOptionsApply() {
|
|---|
| 374 | return require("./WebpackOptionsApply");
|
|---|
| 375 | },
|
|---|
| 376 | get WebpackOptionsDefaulter() {
|
|---|
| 377 | return util.deprecate(
|
|---|
| 378 | () => require("./WebpackOptionsDefaulter"),
|
|---|
| 379 | "webpack.WebpackOptionsDefaulter is deprecated and has been replaced by webpack.config.getNormalizedWebpackOptions and webpack.config.applyWebpackOptionsDefaults",
|
|---|
| 380 | "DEP_WEBPACK_OPTIONS_DEFAULTER"
|
|---|
| 381 | )();
|
|---|
| 382 | },
|
|---|
| 383 | // TODO webpack 6 remove
|
|---|
| 384 | get WebpackOptionsValidationError() {
|
|---|
| 385 | return require("schema-utils").ValidationError;
|
|---|
| 386 | },
|
|---|
| 387 | get ValidationError() {
|
|---|
| 388 | return require("schema-utils").ValidationError;
|
|---|
| 389 | },
|
|---|
| 390 |
|
|---|
| 391 | cache: {
|
|---|
| 392 | get MemoryCachePlugin() {
|
|---|
| 393 | return require("./cache/MemoryCachePlugin");
|
|---|
| 394 | }
|
|---|
| 395 | },
|
|---|
| 396 |
|
|---|
| 397 | config: {
|
|---|
| 398 | get getNormalizedWebpackOptions() {
|
|---|
| 399 | return require("./config/normalization").getNormalizedWebpackOptions;
|
|---|
| 400 | },
|
|---|
| 401 | get applyWebpackOptionsDefaults() {
|
|---|
| 402 | return require("./config/defaults").applyWebpackOptionsDefaults;
|
|---|
| 403 | }
|
|---|
| 404 | },
|
|---|
| 405 |
|
|---|
| 406 | dependencies: {
|
|---|
| 407 | get ModuleDependency() {
|
|---|
| 408 | return require("./dependencies/ModuleDependency");
|
|---|
| 409 | },
|
|---|
| 410 | get HarmonyImportDependency() {
|
|---|
| 411 | return require("./dependencies/HarmonyImportDependency");
|
|---|
| 412 | },
|
|---|
| 413 | get ConstDependency() {
|
|---|
| 414 | return require("./dependencies/ConstDependency");
|
|---|
| 415 | },
|
|---|
| 416 | get NullDependency() {
|
|---|
| 417 | return require("./dependencies/NullDependency");
|
|---|
| 418 | }
|
|---|
| 419 | },
|
|---|
| 420 |
|
|---|
| 421 | ids: {
|
|---|
| 422 | get ChunkModuleIdRangePlugin() {
|
|---|
| 423 | return require("./ids/ChunkModuleIdRangePlugin");
|
|---|
| 424 | },
|
|---|
| 425 | get NaturalModuleIdsPlugin() {
|
|---|
| 426 | return require("./ids/NaturalModuleIdsPlugin");
|
|---|
| 427 | },
|
|---|
| 428 | get OccurrenceModuleIdsPlugin() {
|
|---|
| 429 | return require("./ids/OccurrenceModuleIdsPlugin");
|
|---|
| 430 | },
|
|---|
| 431 | get NamedModuleIdsPlugin() {
|
|---|
| 432 | return require("./ids/NamedModuleIdsPlugin");
|
|---|
| 433 | },
|
|---|
| 434 | get DeterministicChunkIdsPlugin() {
|
|---|
| 435 | return require("./ids/DeterministicChunkIdsPlugin");
|
|---|
| 436 | },
|
|---|
| 437 | get DeterministicModuleIdsPlugin() {
|
|---|
| 438 | return require("./ids/DeterministicModuleIdsPlugin");
|
|---|
| 439 | },
|
|---|
| 440 | get NamedChunkIdsPlugin() {
|
|---|
| 441 | return require("./ids/NamedChunkIdsPlugin");
|
|---|
| 442 | },
|
|---|
| 443 | get OccurrenceChunkIdsPlugin() {
|
|---|
| 444 | return require("./ids/OccurrenceChunkIdsPlugin");
|
|---|
| 445 | },
|
|---|
| 446 | get HashedModuleIdsPlugin() {
|
|---|
| 447 | return require("./ids/HashedModuleIdsPlugin");
|
|---|
| 448 | }
|
|---|
| 449 | },
|
|---|
| 450 |
|
|---|
| 451 | javascript: {
|
|---|
| 452 | get EnableChunkLoadingPlugin() {
|
|---|
| 453 | return require("./javascript/EnableChunkLoadingPlugin");
|
|---|
| 454 | },
|
|---|
| 455 | get JavascriptModulesPlugin() {
|
|---|
| 456 | return require("./javascript/JavascriptModulesPlugin");
|
|---|
| 457 | },
|
|---|
| 458 | get JavascriptParser() {
|
|---|
| 459 | return require("./javascript/JavascriptParser");
|
|---|
| 460 | }
|
|---|
| 461 | },
|
|---|
| 462 |
|
|---|
| 463 | optimize: {
|
|---|
| 464 | get AggressiveMergingPlugin() {
|
|---|
| 465 | return require("./optimize/AggressiveMergingPlugin");
|
|---|
| 466 | },
|
|---|
| 467 | get AggressiveSplittingPlugin() {
|
|---|
| 468 | return util.deprecate(
|
|---|
| 469 | () => require("./optimize/AggressiveSplittingPlugin"),
|
|---|
| 470 | "AggressiveSplittingPlugin is deprecated in favor of SplitChunksPlugin",
|
|---|
| 471 | "DEP_WEBPACK_AGGRESSIVE_SPLITTING_PLUGIN"
|
|---|
| 472 | )();
|
|---|
| 473 | },
|
|---|
| 474 | get InnerGraph() {
|
|---|
| 475 | return require("./optimize/InnerGraph");
|
|---|
| 476 | },
|
|---|
| 477 | get LimitChunkCountPlugin() {
|
|---|
| 478 | return require("./optimize/LimitChunkCountPlugin");
|
|---|
| 479 | },
|
|---|
| 480 | get MergeDuplicateChunksPlugin() {
|
|---|
| 481 | return require("./optimize/MergeDuplicateChunksPlugin");
|
|---|
| 482 | },
|
|---|
| 483 | get MinChunkSizePlugin() {
|
|---|
| 484 | return require("./optimize/MinChunkSizePlugin");
|
|---|
| 485 | },
|
|---|
| 486 | get ModuleConcatenationPlugin() {
|
|---|
| 487 | return require("./optimize/ModuleConcatenationPlugin");
|
|---|
| 488 | },
|
|---|
| 489 | get RealContentHashPlugin() {
|
|---|
| 490 | return require("./optimize/RealContentHashPlugin");
|
|---|
| 491 | },
|
|---|
| 492 | get RuntimeChunkPlugin() {
|
|---|
| 493 | return require("./optimize/RuntimeChunkPlugin");
|
|---|
| 494 | },
|
|---|
| 495 | get SideEffectsFlagPlugin() {
|
|---|
| 496 | return require("./optimize/SideEffectsFlagPlugin");
|
|---|
| 497 | },
|
|---|
| 498 | get SplitChunksPlugin() {
|
|---|
| 499 | return require("./optimize/SplitChunksPlugin");
|
|---|
| 500 | }
|
|---|
| 501 | },
|
|---|
| 502 |
|
|---|
| 503 | runtime: {
|
|---|
| 504 | get GetChunkFilenameRuntimeModule() {
|
|---|
| 505 | return require("./runtime/GetChunkFilenameRuntimeModule");
|
|---|
| 506 | },
|
|---|
| 507 | get LoadScriptRuntimeModule() {
|
|---|
| 508 | return require("./runtime/LoadScriptRuntimeModule");
|
|---|
| 509 | }
|
|---|
| 510 | },
|
|---|
| 511 |
|
|---|
| 512 | prefetch: {
|
|---|
| 513 | get ChunkPrefetchPreloadPlugin() {
|
|---|
| 514 | return require("./prefetch/ChunkPrefetchPreloadPlugin");
|
|---|
| 515 | }
|
|---|
| 516 | },
|
|---|
| 517 |
|
|---|
| 518 | web: {
|
|---|
| 519 | get FetchCompileWasmPlugin() {
|
|---|
| 520 | return require("./web/FetchCompileWasmPlugin");
|
|---|
| 521 | },
|
|---|
| 522 | get FetchCompileAsyncWasmPlugin() {
|
|---|
| 523 | return require("./web/FetchCompileAsyncWasmPlugin");
|
|---|
| 524 | },
|
|---|
| 525 | get JsonpChunkLoadingRuntimeModule() {
|
|---|
| 526 | return require("./web/JsonpChunkLoadingRuntimeModule");
|
|---|
| 527 | },
|
|---|
| 528 | get JsonpTemplatePlugin() {
|
|---|
| 529 | return require("./web/JsonpTemplatePlugin");
|
|---|
| 530 | },
|
|---|
| 531 | get CssLoadingRuntimeModule() {
|
|---|
| 532 | return require("./css/CssLoadingRuntimeModule");
|
|---|
| 533 | }
|
|---|
| 534 | },
|
|---|
| 535 |
|
|---|
| 536 | esm: {
|
|---|
| 537 | get ModuleChunkLoadingRuntimeModule() {
|
|---|
| 538 | return require("./esm/ModuleChunkLoadingRuntimeModule");
|
|---|
| 539 | }
|
|---|
| 540 | },
|
|---|
| 541 |
|
|---|
| 542 | webworker: {
|
|---|
| 543 | get WebWorkerTemplatePlugin() {
|
|---|
| 544 | return require("./webworker/WebWorkerTemplatePlugin");
|
|---|
| 545 | }
|
|---|
| 546 | },
|
|---|
| 547 |
|
|---|
| 548 | node: {
|
|---|
| 549 | get NodeEnvironmentPlugin() {
|
|---|
| 550 | return require("./node/NodeEnvironmentPlugin");
|
|---|
| 551 | },
|
|---|
| 552 | get NodeSourcePlugin() {
|
|---|
| 553 | return require("./node/NodeSourcePlugin");
|
|---|
| 554 | },
|
|---|
| 555 | get NodeTargetPlugin() {
|
|---|
| 556 | return require("./node/NodeTargetPlugin");
|
|---|
| 557 | },
|
|---|
| 558 | get NodeTemplatePlugin() {
|
|---|
| 559 | return require("./node/NodeTemplatePlugin");
|
|---|
| 560 | },
|
|---|
| 561 | get ReadFileCompileWasmPlugin() {
|
|---|
| 562 | return require("./node/ReadFileCompileWasmPlugin");
|
|---|
| 563 | },
|
|---|
| 564 | get ReadFileCompileAsyncWasmPlugin() {
|
|---|
| 565 | return require("./node/ReadFileCompileAsyncWasmPlugin");
|
|---|
| 566 | }
|
|---|
| 567 | },
|
|---|
| 568 |
|
|---|
| 569 | electron: {
|
|---|
| 570 | get ElectronTargetPlugin() {
|
|---|
| 571 | return require("./electron/ElectronTargetPlugin");
|
|---|
| 572 | }
|
|---|
| 573 | },
|
|---|
| 574 |
|
|---|
| 575 | wasm: {
|
|---|
| 576 | get AsyncWebAssemblyModulesPlugin() {
|
|---|
| 577 | return require("./wasm-async/AsyncWebAssemblyModulesPlugin");
|
|---|
| 578 | },
|
|---|
| 579 | get EnableWasmLoadingPlugin() {
|
|---|
| 580 | return require("./wasm/EnableWasmLoadingPlugin");
|
|---|
| 581 | }
|
|---|
| 582 | },
|
|---|
| 583 |
|
|---|
| 584 | css: {
|
|---|
| 585 | get CssModulesPlugin() {
|
|---|
| 586 | return require("./css/CssModulesPlugin");
|
|---|
| 587 | }
|
|---|
| 588 | },
|
|---|
| 589 |
|
|---|
| 590 | library: {
|
|---|
| 591 | get AbstractLibraryPlugin() {
|
|---|
| 592 | return require("./library/AbstractLibraryPlugin");
|
|---|
| 593 | },
|
|---|
| 594 | get EnableLibraryPlugin() {
|
|---|
| 595 | return require("./library/EnableLibraryPlugin");
|
|---|
| 596 | }
|
|---|
| 597 | },
|
|---|
| 598 |
|
|---|
| 599 | // TODO remove in webpack 6 in favor of `dll` scope
|
|---|
| 600 | get DelegatedPlugin() {
|
|---|
| 601 | return require("./dll/DelegatedPlugin");
|
|---|
| 602 | },
|
|---|
| 603 | get DllPlugin() {
|
|---|
| 604 | return require("./dll/DllPlugin");
|
|---|
| 605 | },
|
|---|
| 606 | get DllReferencePlugin() {
|
|---|
| 607 | return require("./dll/DllReferencePlugin");
|
|---|
| 608 | },
|
|---|
| 609 | get LibManifestPlugin() {
|
|---|
| 610 | return require("./dll/LibManifestPlugin");
|
|---|
| 611 | },
|
|---|
| 612 |
|
|---|
| 613 | dll: {
|
|---|
| 614 | get DelegatedPlugin() {
|
|---|
| 615 | return require("./dll/DelegatedPlugin");
|
|---|
| 616 | },
|
|---|
| 617 | get DllPlugin() {
|
|---|
| 618 | return require("./dll/DllPlugin");
|
|---|
| 619 | },
|
|---|
| 620 | get DllReferencePlugin() {
|
|---|
| 621 | return require("./dll/DllReferencePlugin");
|
|---|
| 622 | },
|
|---|
| 623 | get LibManifestPlugin() {
|
|---|
| 624 | return require("./dll/LibManifestPlugin");
|
|---|
| 625 | }
|
|---|
| 626 | },
|
|---|
| 627 |
|
|---|
| 628 | container: {
|
|---|
| 629 | get ContainerPlugin() {
|
|---|
| 630 | return require("./container/ContainerPlugin");
|
|---|
| 631 | },
|
|---|
| 632 | get ContainerReferencePlugin() {
|
|---|
| 633 | return require("./container/ContainerReferencePlugin");
|
|---|
| 634 | },
|
|---|
| 635 | get ModuleFederationPlugin() {
|
|---|
| 636 | return require("./container/ModuleFederationPlugin");
|
|---|
| 637 | },
|
|---|
| 638 | get scope() {
|
|---|
| 639 | return require("./container/options").scope;
|
|---|
| 640 | }
|
|---|
| 641 | },
|
|---|
| 642 |
|
|---|
| 643 | sharing: {
|
|---|
| 644 | get ConsumeSharedPlugin() {
|
|---|
| 645 | return require("./sharing/ConsumeSharedPlugin");
|
|---|
| 646 | },
|
|---|
| 647 | get ProvideSharedPlugin() {
|
|---|
| 648 | return require("./sharing/ProvideSharedPlugin");
|
|---|
| 649 | },
|
|---|
| 650 | get SharePlugin() {
|
|---|
| 651 | return require("./sharing/SharePlugin");
|
|---|
| 652 | },
|
|---|
| 653 | get scope() {
|
|---|
| 654 | return require("./container/options").scope;
|
|---|
| 655 | }
|
|---|
| 656 | },
|
|---|
| 657 |
|
|---|
| 658 | debug: {
|
|---|
| 659 | get ProfilingPlugin() {
|
|---|
| 660 | return require("./debug/ProfilingPlugin");
|
|---|
| 661 | }
|
|---|
| 662 | },
|
|---|
| 663 |
|
|---|
| 664 | util: {
|
|---|
| 665 | get createHash() {
|
|---|
| 666 | return require("./util/createHash");
|
|---|
| 667 | },
|
|---|
| 668 | get comparators() {
|
|---|
| 669 | return require("./util/comparators");
|
|---|
| 670 | },
|
|---|
| 671 | get runtime() {
|
|---|
| 672 | return require("./util/runtime");
|
|---|
| 673 | },
|
|---|
| 674 | get serialization() {
|
|---|
| 675 | return require("./util/serialization");
|
|---|
| 676 | },
|
|---|
| 677 | get cleverMerge() {
|
|---|
| 678 | return require("./util/cleverMerge").cachedCleverMerge;
|
|---|
| 679 | },
|
|---|
| 680 | get LazySet() {
|
|---|
| 681 | return require("./util/LazySet");
|
|---|
| 682 | },
|
|---|
| 683 | get compileBooleanMatcher() {
|
|---|
| 684 | return require("./util/compileBooleanMatcher");
|
|---|
| 685 | }
|
|---|
| 686 | },
|
|---|
| 687 |
|
|---|
| 688 | get sources() {
|
|---|
| 689 | return require("webpack-sources");
|
|---|
| 690 | },
|
|---|
| 691 |
|
|---|
| 692 | experiments: {
|
|---|
| 693 | schemes: {
|
|---|
| 694 | get HttpUriPlugin() {
|
|---|
| 695 | return require("./schemes/HttpUriPlugin");
|
|---|
| 696 | },
|
|---|
| 697 | get VirtualUrlPlugin() {
|
|---|
| 698 | return require("./schemes/VirtualUrlPlugin");
|
|---|
| 699 | }
|
|---|
| 700 | },
|
|---|
| 701 | ids: {
|
|---|
| 702 | get SyncModuleIdsPlugin() {
|
|---|
| 703 | return require("./ids/SyncModuleIdsPlugin");
|
|---|
| 704 | }
|
|---|
| 705 | }
|
|---|
| 706 | }
|
|---|
| 707 | });
|
|---|