webpack 5.38.0 → 5.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of webpack might be problematic. Click here for more details.

Files changed (58) hide show
  1. package/README.md +10 -10
  2. package/bin/webpack.js +20 -5
  3. package/lib/AsyncDependencyToInitialChunkError.js +0 -2
  4. package/lib/CaseSensitiveModulesWarning.js +0 -2
  5. package/lib/Chunk.js +6 -2
  6. package/lib/ChunkRenderError.js +0 -2
  7. package/lib/CodeGenerationError.js +0 -2
  8. package/lib/CommentCompilationWarning.js +0 -2
  9. package/lib/Compilation.js +43 -28
  10. package/lib/ConcurrentCompilationError.js +0 -2
  11. package/lib/ContextModule.js +2 -1
  12. package/lib/ContextModuleFactory.js +3 -1
  13. package/lib/DllReferencePlugin.js +0 -2
  14. package/lib/ExportsInfo.js +1 -0
  15. package/lib/HarmonyLinkingError.js +0 -2
  16. package/lib/HookWebpackError.js +0 -1
  17. package/lib/InvalidDependenciesModuleWarning.js +0 -2
  18. package/lib/ModuleBuildError.js +0 -2
  19. package/lib/ModuleDependencyError.js +0 -2
  20. package/lib/ModuleDependencyWarning.js +0 -2
  21. package/lib/ModuleError.js +0 -2
  22. package/lib/ModuleNotFoundError.js +0 -2
  23. package/lib/ModuleParseError.js +0 -2
  24. package/lib/ModuleRestoreError.js +0 -2
  25. package/lib/ModuleStoreError.js +0 -2
  26. package/lib/ModuleWarning.js +0 -2
  27. package/lib/NoModeWarning.js +0 -2
  28. package/lib/NormalModule.js +0 -2
  29. package/lib/UnsupportedFeatureWarning.js +0 -2
  30. package/lib/WarnDeprecatedOptionPlugin.js +0 -2
  31. package/lib/WebpackError.js +0 -2
  32. package/lib/cache/PackFileCacheStrategy.js +4 -1
  33. package/lib/cli.js +1 -1
  34. package/lib/config/normalization.js +1 -0
  35. package/lib/dependencies/ContextElementDependency.js +6 -1
  36. package/lib/dependencies/CriticalDependencyWarning.js +0 -2
  37. package/lib/dependencies/ImportParserPlugin.js +1 -0
  38. package/lib/dependencies/RequireIncludeDependencyParserPlugin.js +0 -2
  39. package/lib/dependencies/SystemPlugin.js +0 -2
  40. package/lib/errors/BuildCycleError.js +0 -1
  41. package/lib/hmr/LazyCompilationPlugin.js +3 -1
  42. package/lib/javascript/JavascriptParser.js +10 -3
  43. package/lib/node/NodeTargetPlugin.js +1 -0
  44. package/lib/optimize/InnerGraphPlugin.js +33 -2
  45. package/lib/performance/AssetsOverSizeLimitWarning.js +0 -2
  46. package/lib/performance/EntrypointsOverSizeLimitWarning.js +0 -2
  47. package/lib/performance/NoAsyncChunksWarning.js +0 -2
  48. package/lib/serialization/PlainObjectSerializer.js +17 -8
  49. package/lib/serialization/Serializer.js +2 -2
  50. package/lib/serialization/SerializerMiddleware.js +26 -4
  51. package/lib/util/ArrayQueue.js +8 -0
  52. package/lib/util/AsyncQueue.js +9 -0
  53. package/lib/util/LazySet.js +26 -17
  54. package/lib/wasm-sync/UnsupportedWebAssemblyFeatureError.js +0 -2
  55. package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +2 -2
  56. package/lib/wasm-sync/WebAssemblyInInitialChunkError.js +0 -2
  57. package/package.json +4 -4
  58. package/types.d.ts +17 -11
package/README.md CHANGED
@@ -40,7 +40,7 @@
40
40
  </a>
41
41
  <h1>webpack</h1>
42
42
  <p>
43
- webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable of transforming, bundling, or packaging just about any resource or asset.
43
+ Webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable of transforming, bundling, or packaging just about any resource or asset.
44
44
  </p>
45
45
  </div>
46
46
 
@@ -77,7 +77,7 @@ yarn add webpack --dev
77
77
 
78
78
  <h2 align="center">Introduction</h2>
79
79
 
80
- webpack is a bundler for modules. The main purpose is to bundle JavaScript
80
+ Webpack is a bundler for modules. The main purpose is to bundle JavaScript
81
81
  files for usage in a browser, yet it is also capable of transforming, bundling,
82
82
  or packaging just about any resource or asset.
83
83
 
@@ -95,14 +95,14 @@ Check out webpack's quick [**Get Started**](https://webpack.js.org/guides/gettin
95
95
 
96
96
  ### Browser Compatibility
97
97
 
98
- webpack supports all browsers that are [ES5-compliant](https://kangax.github.io/compat-table/es5/) (IE8 and below are not supported).
99
- webpack also needs `Promise` for `import()` and `require.ensure()`. If you want to support older browsers, you will need to [load a polyfill](https://webpack.js.org/guides/shimming/) before using these expressions.
98
+ Webpack supports all browsers that are [ES5-compliant](https://kangax.github.io/compat-table/es5/) (IE8 and below are not supported).
99
+ Webpack also needs `Promise` for `import()` and `require.ensure()`. If you want to support older browsers, you will need to [load a polyfill](https://webpack.js.org/guides/shimming/) before using these expressions.
100
100
 
101
101
  <h2 align="center">Concepts</h2>
102
102
 
103
103
  ### [Plugins](https://webpack.js.org/plugins/)
104
104
 
105
- webpack has a [rich plugin
105
+ Webpack has a [rich plugin
106
106
  interface](https://webpack.js.org/plugins/). Most of the features
107
107
  within webpack itself use this plugin interface. This makes webpack very
108
108
  **flexible**.
@@ -129,7 +129,7 @@ within webpack itself use this plugin interface. This makes webpack very
129
129
 
130
130
  ### [Loaders](https://webpack.js.org/loaders/)
131
131
 
132
- webpack enables the use of loaders to preprocess files. This allows you to bundle
132
+ Webpack enables the use of loaders to preprocess files. This allows you to bundle
133
133
  **any static resource** way beyond JavaScript. You can easily [write your own
134
134
  loaders](https://webpack.js.org/api/loaders/) using Node.js.
135
135
 
@@ -249,23 +249,23 @@ or are automatically applied via regex from your webpack configuration.
249
249
 
250
250
  ### Performance
251
251
 
252
- webpack uses async I/O and has multiple caching levels. This makes webpack fast
252
+ Webpack uses async I/O and has multiple caching levels. This makes webpack fast
253
253
  and incredibly **fast** on incremental compilations.
254
254
 
255
255
  ### Module Formats
256
256
 
257
- webpack supports ES2015+, CommonJS and AMD modules **out of the box**. It performs clever static
257
+ Webpack supports ES2015+, CommonJS and AMD modules **out of the box**. It performs clever static
258
258
  analysis on the AST of your code. It even has an evaluation engine to evaluate
259
259
  simple expressions. This allows you to **support most existing libraries** out of the box.
260
260
 
261
261
  ### [Code Splitting](https://webpack.js.org/guides/code-splitting/)
262
262
 
263
- webpack allows you to split your codebase into multiple chunks. Chunks are
263
+ Webpack allows you to split your codebase into multiple chunks. Chunks are
264
264
  loaded asynchronously at runtime. This reduces the initial loading time.
265
265
 
266
266
  ### [Optimizations](https://webpack.js.org/guides/production-build/)
267
267
 
268
- webpack can do many optimizations to **reduce the output size of your
268
+ Webpack can do many optimizations to **reduce the output size of your
269
269
  JavaScript** by deduplicating frequently used modules, minifying, and giving
270
270
  you full control of what is loaded initially and what is loaded at runtime
271
271
  through code splitting. It can also make your code chunks **cache
package/bin/webpack.js CHANGED
@@ -32,13 +32,28 @@ const runCommand = (command, args) => {
32
32
  * @returns {boolean} is the package installed?
33
33
  */
34
34
  const isInstalled = packageName => {
35
- try {
36
- require.resolve(packageName);
37
-
35
+ if (process.versions.pnp) {
38
36
  return true;
39
- } catch (err) {
40
- return false;
41
37
  }
38
+
39
+ const path = require("path");
40
+ const fs = require("graceful-fs");
41
+
42
+ let dir = __dirname;
43
+
44
+ do {
45
+ try {
46
+ if (
47
+ fs.statSync(path.join(dir, "node_modules", packageName)).isDirectory()
48
+ ) {
49
+ return true;
50
+ }
51
+ } catch (_error) {
52
+ // Nothing
53
+ }
54
+ } while (dir !== (dir = path.dirname(dir)));
55
+
56
+ return false;
42
57
  };
43
58
 
44
59
  /**
@@ -25,8 +25,6 @@ class AsyncDependencyToInitialChunkError extends WebpackError {
25
25
  this.name = "AsyncDependencyToInitialChunkError";
26
26
  this.module = module;
27
27
  this.loc = loc;
28
-
29
- Error.captureStackTrace(this, this.constructor);
30
28
  }
31
29
  }
32
30
 
@@ -65,8 +65,6 @@ ${modulesList}`);
65
65
 
66
66
  this.name = "CaseSensitiveModulesWarning";
67
67
  this.module = sortedModules[0];
68
-
69
- Error.captureStackTrace(this, this.constructor);
70
68
  }
71
69
  }
72
70
 
package/lib/Chunk.js CHANGED
@@ -598,8 +598,12 @@ class Chunk {
598
598
  */
599
599
  getAllInitialChunks() {
600
600
  const chunks = new Set();
601
- for (const group of this.groupsIterable) {
602
- for (const c of group.chunks) chunks.add(c);
601
+ const queue = new Set(this.groupsIterable);
602
+ for (const group of queue) {
603
+ if (group.isInitial()) {
604
+ for (const c of group.chunks) chunks.add(c);
605
+ for (const g of group.childrenIterable) queue.add(g);
606
+ }
603
607
  }
604
608
  return chunks;
605
609
  }
@@ -25,8 +25,6 @@ class ChunkRenderError extends WebpackError {
25
25
  this.details = error.stack;
26
26
  this.file = file;
27
27
  this.chunk = chunk;
28
-
29
- Error.captureStackTrace(this, this.constructor);
30
28
  }
31
29
  }
32
30
 
@@ -23,8 +23,6 @@ class CodeGenerationError extends WebpackError {
23
23
  this.message = error.message;
24
24
  this.details = error.stack;
25
25
  this.module = module;
26
-
27
- Error.captureStackTrace(this, this.constructor);
28
26
  }
29
27
  }
30
28
 
@@ -22,8 +22,6 @@ class CommentCompilationWarning extends WebpackError {
22
22
  this.name = "CommentCompilationWarning";
23
23
 
24
24
  this.loc = loc;
25
-
26
- Error.captureStackTrace(this, this.constructor);
27
25
  }
28
26
  }
29
27
 
@@ -337,6 +337,31 @@ const deprecatedNormalModuleLoaderHook = util.deprecate(
337
337
  "DEP_WEBPACK_COMPILATION_NORMAL_MODULE_LOADER_HOOK"
338
338
  );
339
339
 
340
+ // TODO webpack 6: remove
341
+ const defineRemovedModuleTemplates = moduleTemplates => {
342
+ Object.defineProperties(moduleTemplates, {
343
+ asset: {
344
+ enumerable: false,
345
+ configurable: false,
346
+ get: () => {
347
+ throw new WebpackError(
348
+ "Compilation.moduleTemplates.asset has been removed"
349
+ );
350
+ }
351
+ },
352
+ webassembly: {
353
+ enumerable: false,
354
+ configurable: false,
355
+ get: () => {
356
+ throw new WebpackError(
357
+ "Compilation.moduleTemplates.webassembly has been removed"
358
+ );
359
+ }
360
+ }
361
+ });
362
+ moduleTemplates = undefined;
363
+ };
364
+
340
365
  const byId = compareSelect(
341
366
  /**
342
367
  * @param {Chunk} c chunk
@@ -861,26 +886,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
861
886
  this.moduleTemplates = {
862
887
  javascript: new ModuleTemplate(this.runtimeTemplate, this)
863
888
  };
864
- Object.defineProperties(this.moduleTemplates, {
865
- asset: {
866
- enumerable: false,
867
- configurable: false,
868
- get() {
869
- throw new WebpackError(
870
- "Compilation.moduleTemplates.asset has been removed"
871
- );
872
- }
873
- },
874
- webassembly: {
875
- enumerable: false,
876
- configurable: false,
877
- get() {
878
- throw new WebpackError(
879
- "Compilation.moduleTemplates.webassembly has been removed"
880
- );
881
- }
882
- }
883
- });
889
+ defineRemovedModuleTemplates(this.moduleTemplates);
884
890
 
885
891
  this.moduleGraph = new ModuleGraph();
886
892
  /** @type {ChunkGraph} */
@@ -1999,6 +2005,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1999
2005
  }
2000
2006
 
2001
2007
  finish(callback) {
2008
+ this.factorizeQueue.clear();
2002
2009
  if (this.profile) {
2003
2010
  this.logger.time("finish module profiles");
2004
2011
  const ParallelismFactorCalculator = require("./util/ParallelismFactorCalculator");
@@ -2233,6 +2240,14 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
2233
2240
  * @returns {void}
2234
2241
  */
2235
2242
  seal(callback) {
2243
+ const finalCallback = err => {
2244
+ this.factorizeQueue.clear();
2245
+ this.buildQueue.clear();
2246
+ this.rebuildQueue.clear();
2247
+ this.processDependenciesQueue.clear();
2248
+ this.addModuleQueue.clear();
2249
+ return callback(err);
2250
+ };
2236
2251
  const chunkGraph = new ChunkGraph(this.moduleGraph);
2237
2252
  this.chunkGraph = chunkGraph;
2238
2253
 
@@ -2397,7 +2412,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
2397
2412
 
2398
2413
  this.hooks.optimizeTree.callAsync(this.chunks, this.modules, err => {
2399
2414
  if (err) {
2400
- return callback(
2415
+ return finalCallback(
2401
2416
  makeWebpackError(err, "Compilation.hooks.optimizeTree")
2402
2417
  );
2403
2418
  }
@@ -2409,7 +2424,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
2409
2424
  this.modules,
2410
2425
  err => {
2411
2426
  if (err) {
2412
- return callback(
2427
+ return finalCallback(
2413
2428
  makeWebpackError(err, "Compilation.hooks.optimizeChunkModules")
2414
2429
  );
2415
2430
  }
@@ -2452,7 +2467,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
2452
2467
  this.hooks.beforeCodeGeneration.call();
2453
2468
  this.codeGeneration(err => {
2454
2469
  if (err) {
2455
- return callback(err);
2470
+ return finalCallback(err);
2456
2471
  }
2457
2472
  this.hooks.afterCodeGeneration.call();
2458
2473
  this.logger.timeEnd("code generation");
@@ -2471,7 +2486,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
2471
2486
 
2472
2487
  this._runCodeGenerationJobs(codeGenerationJobs, err => {
2473
2488
  if (err) {
2474
- return callback(err);
2489
+ return finalCallback(err);
2475
2490
  }
2476
2491
 
2477
2492
  if (shouldRecord) {
@@ -2491,7 +2506,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
2491
2506
  this.logger.time("process assets");
2492
2507
  this.hooks.processAssets.callAsync(this.assets, err => {
2493
2508
  if (err) {
2494
- return callback(
2509
+ return finalCallback(
2495
2510
  makeWebpackError(err, "Compilation.hooks.processAssets")
2496
2511
  );
2497
2512
  }
@@ -2517,12 +2532,12 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
2517
2532
  }
2518
2533
  return this.hooks.afterSeal.callAsync(err => {
2519
2534
  if (err) {
2520
- return callback(
2535
+ return finalCallback(
2521
2536
  makeWebpackError(err, "Compilation.hooks.afterSeal")
2522
2537
  );
2523
2538
  }
2524
2539
  this.fileSystemInfo.logStatistics();
2525
- callback();
2540
+ finalCallback();
2526
2541
  });
2527
2542
  });
2528
2543
  };
@@ -2533,7 +2548,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
2533
2548
  this.createChunkAssets(err => {
2534
2549
  this.logger.timeEnd("create chunk assets");
2535
2550
  if (err) {
2536
- return callback(err);
2551
+ return finalCallback(err);
2537
2552
  }
2538
2553
  cont();
2539
2554
  });
@@ -14,7 +14,5 @@ module.exports = class ConcurrentCompilationError extends WebpackError {
14
14
  this.name = "ConcurrentCompilationError";
15
15
  this.message =
16
16
  "You ran Webpack twice. Each instance only supports a single concurrent compilation at a time.";
17
-
18
- Error.captureStackTrace(this, this.constructor);
19
17
  }
20
18
  };
@@ -54,6 +54,7 @@ const makeSerializable = require("./util/makeSerializable");
54
54
  * @property {RegExp=} include
55
55
  * @property {RegExp=} exclude
56
56
  * @property {RawChunkGroupOptions=} groupOptions
57
+ * @property {string=} typePrefix
57
58
  * @property {string=} category
58
59
  * @property {string[][]=} referencedExports exports referenced from modules (won't be mangled)
59
60
  */
@@ -577,7 +578,7 @@ class ContextModule extends Module {
577
578
  fakeMapDataExpression = "fakeMap[id]"
578
579
  ) {
579
580
  if (typeof fakeMap === "number") {
580
- return `return ${this.getReturn(fakeMap)};`;
581
+ return `return ${this.getReturn(fakeMap, asyncModule)};`;
581
582
  }
582
583
  return `return ${
583
584
  RuntimeGlobals.createFakeNamespaceObject
@@ -273,7 +273,8 @@ module.exports = class ContextModuleFactory extends ModuleFactory {
273
273
  include,
274
274
  exclude,
275
275
  referencedExports,
276
- category
276
+ category,
277
+ typePrefix
277
278
  } = options;
278
279
  if (!regExp || !resource) return callback(null, []);
279
280
 
@@ -346,6 +347,7 @@ module.exports = class ContextModuleFactory extends ModuleFactory {
346
347
  const dep = new ContextElementDependency(
347
348
  obj.request + resourceQuery + resourceFragment,
348
349
  obj.request,
350
+ typePrefix,
349
351
  category,
350
352
  referencedExports
351
353
  );
@@ -156,8 +156,6 @@ class DllManifestError extends WebpackError {
156
156
 
157
157
  this.name = "DllManifestError";
158
158
  this.message = `Dll manifest ${filename}\n${message}`;
159
-
160
- Error.captureStackTrace(this, this.constructor);
161
159
  }
162
160
  }
163
161
 
@@ -146,6 +146,7 @@ class ExportsInfo {
146
146
  for (const entry of exports.values()) {
147
147
  const name = namesInOrder[i];
148
148
  if (entry.name !== name) break;
149
+ i++;
149
150
  }
150
151
  for (; i < namesInOrder.length; i++) {
151
152
  const name = namesInOrder[i];
@@ -12,7 +12,5 @@ module.exports = class HarmonyLinkingError extends WebpackError {
12
12
  super(message);
13
13
  this.name = "HarmonyLinkingError";
14
14
  this.hideStack = true;
15
-
16
- Error.captureStackTrace(this, this.constructor);
17
15
  }
18
16
  };
@@ -32,7 +32,6 @@ class HookWebpackError extends WebpackError {
32
32
  this.hideStack = true;
33
33
  this.details = `caused by plugins in ${hook}\n${error.stack}`;
34
34
 
35
- Error.captureStackTrace(this, this.constructor);
36
35
  this.stack += `\n-- inner error --\n${error.stack}`;
37
36
  }
38
37
  }
@@ -33,8 +33,6 @@ ${depsList.slice(0, 3).join("\n")}${
33
33
  this.name = "InvalidDependenciesModuleWarning";
34
34
  this.details = depsList.slice(3).join("\n");
35
35
  this.module = module;
36
-
37
- Error.captureStackTrace(this, this.constructor);
38
36
  }
39
37
  }
40
38
 
@@ -53,8 +53,6 @@ class ModuleBuildError extends WebpackError {
53
53
  this.name = "ModuleBuildError";
54
54
  this.details = details;
55
55
  this.error = err;
56
-
57
- Error.captureStackTrace(this, this.constructor);
58
56
  }
59
57
 
60
58
  serialize(context) {
@@ -30,8 +30,6 @@ class ModuleDependencyError extends WebpackError {
30
30
  /** error is not (de)serialized, so it might be undefined after deserialization */
31
31
  this.error = err;
32
32
 
33
- Error.captureStackTrace(this, this.constructor);
34
-
35
33
  if (err && /** @type {any} */ (err).hideStack) {
36
34
  this.stack =
37
35
  err.stack.split("\n").slice(1).join("\n") + "\n\n" + this.stack;
@@ -30,8 +30,6 @@ class ModuleDependencyWarning extends WebpackError {
30
30
  /** error is not (de)serialized, so it might be undefined after deserialization */
31
31
  this.error = err;
32
32
 
33
- Error.captureStackTrace(this, this.constructor);
34
-
35
33
  if (err && /** @type {any} */ (err).hideStack) {
36
34
  this.stack =
37
35
  err.stack.split("\n").slice(1).join("\n") + "\n\n" + this.stack;
@@ -37,8 +37,6 @@ class ModuleError extends WebpackError {
37
37
  err && typeof err === "object" && err.stack
38
38
  ? cleanUp(err.stack, this.message)
39
39
  : undefined;
40
-
41
- Error.captureStackTrace(this, this.constructor);
42
40
  }
43
41
 
44
42
  serialize(context) {
@@ -80,8 +80,6 @@ class ModuleNotFoundError extends WebpackError {
80
80
  this.module = module;
81
81
  this.error = err;
82
82
  this.loc = loc;
83
-
84
- Error.captureStackTrace(this, this.constructor);
85
83
  }
86
84
  }
87
85
 
@@ -85,8 +85,6 @@ class ModuleParseError extends WebpackError {
85
85
  this.name = "ModuleParseError";
86
86
  this.loc = loc;
87
87
  this.error = err;
88
-
89
- Error.captureStackTrace(this, this.constructor);
90
88
  }
91
89
 
92
90
  serialize(context) {
@@ -36,8 +36,6 @@ class ModuleRestoreError extends WebpackError {
36
36
  this.details = details;
37
37
  this.module = module;
38
38
  this.error = err;
39
-
40
- Error.captureStackTrace(this, this.constructor);
41
39
  }
42
40
  }
43
41
 
@@ -36,8 +36,6 @@ class ModuleStoreError extends WebpackError {
36
36
  this.details = details;
37
37
  this.module = module;
38
38
  this.error = err;
39
-
40
- Error.captureStackTrace(this, this.constructor);
41
39
  }
42
40
  }
43
41
 
@@ -37,8 +37,6 @@ class ModuleWarning extends WebpackError {
37
37
  warning && typeof warning === "object" && warning.stack
38
38
  ? cleanUp(warning.stack, this.message)
39
39
  : undefined;
40
-
41
- Error.captureStackTrace(this, this.constructor);
42
40
  }
43
41
 
44
42
  serialize(context) {
@@ -18,7 +18,5 @@ module.exports = class NoModeWarning extends WebpackError {
18
18
  "Set 'mode' option to 'development' or 'production' to enable defaults for each environment.\n" +
19
19
  "You can also set it to 'none' to disable any default behavior. " +
20
20
  "Learn more: https://webpack.js.org/configuration/mode/";
21
-
22
- Error.captureStackTrace(this, this.constructor);
23
21
  }
24
22
  };
@@ -164,8 +164,6 @@ class NonErrorEmittedError extends WebpackError {
164
164
 
165
165
  this.name = "NonErrorEmittedError";
166
166
  this.message = "(Emitted value instead of an instance of Error) " + error;
167
-
168
- Error.captureStackTrace(this, this.constructor);
169
167
  }
170
168
  }
171
169
 
@@ -21,8 +21,6 @@ class UnsupportedFeatureWarning extends WebpackError {
21
21
  this.name = "UnsupportedFeatureWarning";
22
22
  this.loc = loc;
23
23
  this.hideStack = true;
24
-
25
- Error.captureStackTrace(this, this.constructor);
26
24
  }
27
25
  }
28
26
 
@@ -48,8 +48,6 @@ class DeprecatedOptionWarning extends WebpackError {
48
48
  "configuration\n" +
49
49
  `The value '${value}' for option '${option}' is deprecated. ` +
50
50
  `Use '${suggestion}' instead.`;
51
-
52
- Error.captureStackTrace(this, this.constructor);
53
51
  }
54
52
  }
55
53
 
@@ -31,8 +31,6 @@ class WebpackError extends Error {
31
31
  this.chunk = undefined;
32
32
  /** @type {string} */
33
33
  this.file = undefined;
34
-
35
- Error.captureStackTrace(this, this.constructor);
36
34
  }
37
35
 
38
36
  [inspect]() {
@@ -8,6 +8,7 @@
8
8
  const FileSystemInfo = require("../FileSystemInfo");
9
9
  const ProgressPlugin = require("../ProgressPlugin");
10
10
  const { formatSize } = require("../SizeFormatHelpers");
11
+ const SerializerMiddleware = require("../serialization/SerializerMiddleware");
11
12
  const LazySet = require("../util/LazySet");
12
13
  const makeSerializable = require("../util/makeSerializable");
13
14
  const memoize = require("../util/memoize");
@@ -677,7 +678,7 @@ class PackContent {
677
678
  */
678
679
  constructor(items, usedItems, dataOrFn, logger, lazyName) {
679
680
  this.items = items;
680
- /** @type {function(): PackContentItems | Promise<PackContentItems>} */
681
+ /** @type {function(): Promise<PackContentItems> | PackContentItems } */
681
682
  this.lazy = typeof dataOrFn === "function" ? dataOrFn : undefined;
682
683
  /** @type {Map<string, any>} */
683
684
  this.content = typeof dataOrFn === "function" ? undefined : dataOrFn.map;
@@ -715,6 +716,7 @@ class PackContent {
715
716
  this.logger.timeEnd(timeMessage);
716
717
  }
717
718
  this.content = map;
719
+ this.lazy = SerializerMiddleware.unMemoizeLazy(this.lazy);
718
720
  return map.get(identifier);
719
721
  });
720
722
  } else {
@@ -723,6 +725,7 @@ class PackContent {
723
725
  this.logger.timeEnd(timeMessage);
724
726
  }
725
727
  this.content = map;
728
+ this.lazy = SerializerMiddleware.unMemoizeLazy(this.lazy);
726
729
  return map.get(identifier);
727
730
  }
728
731
  }
package/lib/cli.js CHANGED
@@ -148,7 +148,7 @@ const getArguments = (schema = webpackSchema) => {
148
148
  {
149
149
  type: "reset",
150
150
  multiple: false,
151
- description: `Clear all items provided in configuration. ${description}`,
151
+ description: `Clear all items provided in '${schemaPath}' configuration. ${description}`,
152
152
  path: schemaPath
153
153
  }
154
154
  ],
@@ -129,6 +129,7 @@ const getNormalizedWebpackOptions = config => {
129
129
  case "filesystem":
130
130
  return {
131
131
  type: "filesystem",
132
+ allowCollectingMemory: cache.allowCollectingMemory,
132
133
  maxMemoryGenerations: cache.maxMemoryGenerations,
133
134
  maxAge: cache.maxAge,
134
135
  profile: cache.profile,
@@ -14,9 +14,10 @@ const ModuleDependency = require("./ModuleDependency");
14
14
  /** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */
15
15
 
16
16
  class ContextElementDependency extends ModuleDependency {
17
- constructor(request, userRequest, category, referencedExports) {
17
+ constructor(request, userRequest, typePrefix, category, referencedExports) {
18
18
  super(request);
19
19
  this.referencedExports = referencedExports;
20
+ this._typePrefix = typePrefix;
20
21
  this._category = category;
21
22
 
22
23
  if (userRequest) {
@@ -25,6 +26,10 @@ class ContextElementDependency extends ModuleDependency {
25
26
  }
26
27
 
27
28
  get type() {
29
+ if (this._typePrefix) {
30
+ return `${this._typePrefix} context element`;
31
+ }
32
+
28
33
  return "context element";
29
34
  }
30
35
 
@@ -14,8 +14,6 @@ class CriticalDependencyWarning extends WebpackError {
14
14
 
15
15
  this.name = "CriticalDependencyWarning";
16
16
  this.message = "Critical dependency: " + message;
17
-
18
- Error.captureStackTrace(this, this.constructor);
19
17
  }
20
18
  }
21
19
 
@@ -248,6 +248,7 @@ class ImportParserPlugin {
248
248
  namespaceObject: parser.state.module.buildMeta.strictHarmonyModule
249
249
  ? "strict"
250
250
  : true,
251
+ typePrefix: "import()",
251
252
  category: "esm",
252
253
  referencedExports: exports
253
254
  },
@@ -67,8 +67,6 @@ class RequireIncludeDeprecationWarning extends WebpackError {
67
67
  this.name = "RequireIncludeDeprecationWarning";
68
68
 
69
69
  this.loc = loc;
70
-
71
- Error.captureStackTrace(this, this.constructor);
72
70
  }
73
71
  }
74
72
 
@@ -127,8 +127,6 @@ class SystemImportDeprecationWarning extends WebpackError {
127
127
  this.name = "SystemImportDeprecationWarning";
128
128
 
129
129
  this.loc = loc;
130
-
131
- Error.captureStackTrace(this, this.constructor);
132
130
  }
133
131
  }
134
132
 
@@ -21,7 +21,6 @@ class BuildCycleError extends WebpackError {
21
21
 
22
22
  this.name = "BuildCycleError";
23
23
  this.module = module;
24
- Error.captureStackTrace(this, this.constructor);
25
24
  }
26
25
  }
27
26
 
@@ -350,7 +350,9 @@ class LazyCompilationPlugin {
350
350
  resolveData.dependencies.every(
351
351
  dep =>
352
352
  IGNORED_DEPENDENCY_TYPES.has(dep.type) ||
353
- (this.imports && dep.type === "import()") ||
353
+ (this.imports &&
354
+ (dep.type === "import()" ||
355
+ dep.type === "import() context element")) ||
354
356
  (this.entries && dep.type === "entry")
355
357
  ) &&
356
358
  !/webpack[/\\]hot[/\\]|webpack-dev-server[/\\]client/.test(
@@ -175,11 +175,18 @@ class JavascriptParser extends Parser {
175
175
  /** @type {SyncBailHook<[IfStatementNode], boolean | void>} */
176
176
  statementIf: new SyncBailHook(["statement"]),
177
177
  /** @type {SyncBailHook<[ExpressionNode, ClassExpressionNode | ClassDeclarationNode], boolean | void>} */
178
- classExtendsExpression: new SyncBailHook(["expression", "statement"]),
178
+ classExtendsExpression: new SyncBailHook([
179
+ "expression",
180
+ "classDefinition"
181
+ ]),
179
182
  /** @type {SyncBailHook<[MethodDefinitionNode | PropertyDefinitionNode, ClassExpressionNode | ClassDeclarationNode], boolean | void>} */
180
- classBodyElement: new SyncBailHook(["element", "statement"]),
183
+ classBodyElement: new SyncBailHook(["element", "classDefinition"]),
181
184
  /** @type {SyncBailHook<[ExpressionNode, MethodDefinitionNode | PropertyDefinitionNode, ClassExpressionNode | ClassDeclarationNode], boolean | void>} */
182
- classBodyValue: new SyncBailHook(["expression", "element", "statement"]),
185
+ classBodyValue: new SyncBailHook([
186
+ "expression",
187
+ "element",
188
+ "classDefinition"
189
+ ]),
183
190
  /** @type {HookMap<SyncBailHook<[LabeledStatementNode], boolean | void>>} */
184
191
  label: new HookMap(() => new SyncBailHook(["statement"])),
185
192
  /** @type {SyncBailHook<[StatementNode, ImportSource], boolean | void>} */
@@ -55,6 +55,7 @@ const builtins = [
55
55
  "wasi",
56
56
  "worker_threads",
57
57
  "zlib",
58
+ /^node:/,
58
59
 
59
60
  // cspell:word pnpapi
60
61
  // Yarn PnP adds pnpapi as "builtin"
@@ -238,12 +238,25 @@ class InnerGraphPlugin {
238
238
  }
239
239
  );
240
240
 
241
+ parser.hooks.classBodyElement.tap(
242
+ "InnerGraphPlugin",
243
+ (element, classDefinition) => {
244
+ if (!InnerGraph.isEnabled(parser.state)) return;
245
+ if (parser.scope.topLevelScope === true) {
246
+ const fn = classWithTopLevelSymbol.get(classDefinition);
247
+ if (fn) {
248
+ InnerGraph.setTopLevelSymbol(parser.state, undefined);
249
+ }
250
+ }
251
+ }
252
+ );
253
+
241
254
  parser.hooks.classBodyValue.tap(
242
255
  "InnerGraphPlugin",
243
- (expression, element, statement) => {
256
+ (expression, element, classDefinition) => {
244
257
  if (!InnerGraph.isEnabled(parser.state)) return;
245
258
  if (parser.scope.topLevelScope === true) {
246
- const fn = classWithTopLevelSymbol.get(statement);
259
+ const fn = classWithTopLevelSymbol.get(classDefinition);
247
260
  if (fn) {
248
261
  if (
249
262
  !element.static ||
@@ -253,6 +266,24 @@ class InnerGraphPlugin {
253
266
  )
254
267
  ) {
255
268
  InnerGraph.setTopLevelSymbol(parser.state, fn);
269
+ if (element.type !== "MethodDefinition" && element.static) {
270
+ InnerGraph.onUsage(parser.state, usedByExports => {
271
+ switch (usedByExports) {
272
+ case undefined:
273
+ case true:
274
+ return;
275
+ default: {
276
+ const dep = new PureExpressionDependency(
277
+ expression.range
278
+ );
279
+ dep.loc = expression.loc;
280
+ dep.usedByExports = usedByExports;
281
+ parser.state.module.addDependency(dep);
282
+ break;
283
+ }
284
+ }
285
+ });
286
+ }
256
287
  } else {
257
288
  InnerGraph.setTopLevelSymbol(parser.state, undefined);
258
289
  }
@@ -28,7 +28,5 @@ Assets: ${assetLists}`);
28
28
 
29
29
  this.name = "AssetsOverSizeLimitWarning";
30
30
  this.assets = assetsOverSizeLimit;
31
-
32
- Error.captureStackTrace(this, this.constructor);
33
31
  }
34
32
  };
@@ -31,7 +31,5 @@ Entrypoints:${entrypointList}\n`);
31
31
 
32
32
  this.name = "EntrypointsOverSizeLimitWarning";
33
33
  this.entrypoints = entrypoints;
34
-
35
- Error.captureStackTrace(this, this.constructor);
36
34
  }
37
35
  };
@@ -16,7 +16,5 @@ module.exports = class NoAsyncChunksWarning extends WebpackError {
16
16
  );
17
17
 
18
18
  this.name = "NoAsyncChunksWarning";
19
-
20
- Error.captureStackTrace(this, this.constructor);
21
19
  }
22
20
  };
@@ -7,19 +7,21 @@
7
7
  const cache = new WeakMap();
8
8
 
9
9
  class ObjectStructure {
10
- constructor(keys) {
11
- this.keys = keys;
12
- this.children = new Map();
10
+ constructor() {
11
+ this.keys = undefined;
12
+ this.children = undefined;
13
13
  }
14
14
 
15
- getKeys() {
15
+ getKeys(keys) {
16
+ if (this.keys === undefined) this.keys = keys;
16
17
  return this.keys;
17
18
  }
18
19
 
19
20
  key(key) {
21
+ if (this.children === undefined) this.children = new Map();
20
22
  const child = this.children.get(key);
21
23
  if (child !== undefined) return child;
22
- const newChild = new ObjectStructure(this.keys.concat(key));
24
+ const newChild = new ObjectStructure();
23
25
  this.children.set(key, newChild);
24
26
  return newChild;
25
27
  }
@@ -28,20 +30,27 @@ class ObjectStructure {
28
30
  const getCachedKeys = (keys, cacheAssoc) => {
29
31
  let root = cache.get(cacheAssoc);
30
32
  if (root === undefined) {
31
- root = new ObjectStructure([]);
33
+ root = new ObjectStructure();
32
34
  cache.set(cacheAssoc, root);
33
35
  }
34
36
  let current = root;
35
37
  for (const key of keys) {
36
38
  current = current.key(key);
37
39
  }
38
- return current.getKeys();
40
+ return current.getKeys(keys);
39
41
  };
40
42
 
41
43
  class PlainObjectSerializer {
42
44
  serialize(obj, { write }) {
43
45
  const keys = Object.keys(obj);
44
- if (keys.length > 1) {
46
+ if (keys.length > 128) {
47
+ // Objects with so many keys are unlikely to share structure
48
+ // with other objects
49
+ write(keys);
50
+ for (const key of keys) {
51
+ write(obj[key]);
52
+ }
53
+ } else if (keys.length > 1) {
45
54
  write(getCachedKeys(keys, write));
46
55
  for (const key of keys) {
47
56
  write(obj[key]);
@@ -15,7 +15,7 @@ class Serializer {
15
15
  const ctx = { ...context, ...this.context };
16
16
  let current = obj;
17
17
  for (const middleware of this.serializeMiddlewares) {
18
- if (current instanceof Promise) {
18
+ if (current && typeof current.then === "function") {
19
19
  current = current.then(
20
20
  data => data && middleware.serialize(data, context)
21
21
  );
@@ -35,7 +35,7 @@ class Serializer {
35
35
  /** @type {any} */
36
36
  let current = value;
37
37
  for (const middleware of this.deserializeMiddlewares) {
38
- if (current instanceof Promise) {
38
+ if (current && typeof current.then === "function") {
39
39
  current = current.then(data => middleware.deserialize(data, context));
40
40
  } else {
41
41
  current = middleware.deserialize(current, ctx);
@@ -100,9 +100,10 @@ class SerializerMiddleware {
100
100
  static serializeLazy(lazy, serialize) {
101
101
  const fn = memoize(() => {
102
102
  const r = lazy();
103
- if (r instanceof Promise) return r.then(data => data && serialize(data));
104
- if (r) return serialize(r);
105
- return null;
103
+ if (r && typeof r.then === "function") {
104
+ return r.then(data => data && serialize(data));
105
+ }
106
+ return serialize(r);
106
107
  });
107
108
  fn[LAZY_TARGET] = lazy[LAZY_TARGET];
108
109
  /** @type {any} */ (fn).options = /** @type {any} */ (lazy).options;
@@ -118,7 +119,9 @@ class SerializerMiddleware {
118
119
  static deserializeLazy(lazy, deserialize) {
119
120
  const fn = memoize(() => {
120
121
  const r = lazy();
121
- if (r instanceof Promise) return r.then(data => deserialize(data));
122
+ if (r && typeof r.then === "function") {
123
+ return r.then(data => deserialize(data));
124
+ }
122
125
  return deserialize(r);
123
126
  });
124
127
  fn[LAZY_TARGET] = lazy[LAZY_TARGET];
@@ -126,6 +129,25 @@ class SerializerMiddleware {
126
129
  fn[LAZY_SERIALIZED_VALUE] = lazy;
127
130
  return fn;
128
131
  }
132
+
133
+ /**
134
+ * @param {function(): Promise<any> | any} lazy lazy function
135
+ * @returns {function(): Promise<any> | any} new lazy
136
+ */
137
+ static unMemoizeLazy(lazy) {
138
+ if (!SerializerMiddleware.isLazy(lazy)) return lazy;
139
+ const fn = () => {
140
+ throw new Error(
141
+ "A lazy value that has been unmemorized can't be called again"
142
+ );
143
+ };
144
+ fn[LAZY_SERIALIZED_VALUE] = SerializerMiddleware.unMemoizeLazy(
145
+ lazy[LAZY_SERIALIZED_VALUE]
146
+ );
147
+ fn[LAZY_TARGET] = lazy[LAZY_TARGET];
148
+ fn.options = /** @type {any} */ (lazy).options;
149
+ return fn;
150
+ }
129
151
  }
130
152
 
131
153
  module.exports = SerializerMiddleware;
@@ -27,6 +27,14 @@ class ArrayQueue {
27
27
  return this._list.length + this._listReversed.length;
28
28
  }
29
29
 
30
+ /**
31
+ * Empties the queue.
32
+ */
33
+ clear() {
34
+ this._list.length = 0;
35
+ this._listReversed.length = 0;
36
+ }
37
+
30
38
  /**
31
39
  * Appends the specified element to this queue.
32
40
  * @param {T} item The element to add.
@@ -359,6 +359,15 @@ class AsyncQueue {
359
359
  inHandleResult--;
360
360
  });
361
361
  }
362
+
363
+ clear() {
364
+ this._entries.clear();
365
+ this._queued.clear();
366
+ this._activeTasks = 0;
367
+ this._willEnsureProcessing = false;
368
+ this._needProcessing = false;
369
+ this._stopped = false;
370
+ }
362
371
  }
363
372
 
364
373
  module.exports = AsyncQueue;
@@ -24,21 +24,17 @@ const merge = (targetSet, toMerge) => {
24
24
  /**
25
25
  * @template T
26
26
  * @param {Set<Iterable<T>>} targetSet set where iterables should be added
27
- * @param {Array<Iterable<T> | LazySet<T>>} toDeepMerge iterables or lazy set to be flattened
27
+ * @param {Array<LazySet<T>>} toDeepMerge lazy sets to be flattened
28
28
  * @returns {void}
29
29
  */
30
30
  const flatten = (targetSet, toDeepMerge) => {
31
31
  for (const set of toDeepMerge) {
32
- if (set instanceof LazySet) {
33
- if (set._set.size > 0) targetSet.add(set._set);
34
- if (set._needMerge) {
35
- for (const mergedSet of set._toMerge) {
36
- targetSet.add(mergedSet);
37
- }
38
- flatten(targetSet, set._toDeepMerge);
32
+ if (set._set.size > 0) targetSet.add(set._set);
33
+ if (set._needMerge) {
34
+ for (const mergedSet of set._toMerge) {
35
+ targetSet.add(mergedSet);
39
36
  }
40
- } else {
41
- targetSet.add(set);
37
+ flatten(targetSet, set._toDeepMerge);
42
38
  }
43
39
  }
44
40
  };
@@ -58,7 +54,7 @@ class LazySet {
58
54
  this._set = new Set(iterable);
59
55
  /** @type {Set<Iterable<T>>} */
60
56
  this._toMerge = new Set();
61
- /** @type {Array<Iterable<T> | LazySet<T>>} */
57
+ /** @type {Array<LazySet<T>>} */
62
58
  this._toDeepMerge = [];
63
59
  this._needMerge = false;
64
60
  this._deopt = false;
@@ -76,6 +72,14 @@ class LazySet {
76
72
  this._needMerge = false;
77
73
  }
78
74
 
75
+ _isEmpty() {
76
+ return (
77
+ this._set.size === 0 &&
78
+ this._toMerge.size === 0 &&
79
+ this._toDeepMerge.length === 0
80
+ );
81
+ }
82
+
79
83
  get size() {
80
84
  if (this._needMerge) this._merge();
81
85
  return this._set.size;
@@ -101,13 +105,18 @@ class LazySet {
101
105
  _set.add(item);
102
106
  }
103
107
  } else {
104
- this._toDeepMerge.push(iterable);
105
- this._needMerge = true;
106
- // Avoid being too memory hungry
107
- if (this._toDeepMerge.length > 100000) {
108
- this._flatten();
109
- if (this._toMerge.size > 100000) this._merge();
108
+ if (iterable instanceof LazySet) {
109
+ if (iterable._isEmpty()) return this;
110
+ this._toDeepMerge.push(iterable);
111
+ this._needMerge = true;
112
+ if (this._toDeepMerge.length > 100000) {
113
+ this._flatten();
114
+ }
115
+ } else {
116
+ this._toMerge.add(iterable);
117
+ this._needMerge = true;
110
118
  }
119
+ if (this._toMerge.size > 100000) this._merge();
111
120
  }
112
121
  return this;
113
122
  }
@@ -12,7 +12,5 @@ module.exports = class UnsupportedWebAssemblyFeatureError extends WebpackError {
12
12
  super(message);
13
13
  this.name = "UnsupportedWebAssemblyFeatureError";
14
14
  this.hideStack = true;
15
-
16
- Error.captureStackTrace(this, this.constructor);
17
15
  }
18
16
  };
@@ -291,7 +291,7 @@ class WasmChunkLoadingRuntimeModule extends RuntimeModule {
291
291
  "var promise;",
292
292
  this.supportsStreaming
293
293
  ? Template.asString([
294
- "if(importObject instanceof Promise && typeof WebAssembly.compileStreaming === 'function') {",
294
+ "if(importObject && typeof importObject.then === 'function' && typeof WebAssembly.compileStreaming === 'function') {",
295
295
  Template.indent([
296
296
  "promise = Promise.all([WebAssembly.compileStreaming(req), importObject]).then(function(items) {",
297
297
  Template.indent([
@@ -309,7 +309,7 @@ class WasmChunkLoadingRuntimeModule extends RuntimeModule {
309
309
  ])
310
310
  ])
311
311
  : Template.asString([
312
- "if(importObject instanceof Promise) {",
312
+ "if(importObject && typeof importObject.then === 'function') {",
313
313
  Template.indent([
314
314
  "var bytesPromise = req.then(function(x) { return x.arrayBuffer(); });",
315
315
  "promise = Promise.all([",
@@ -102,7 +102,5 @@ ${moduleChains.map(s => `* ${s}`).join("\n")}`;
102
102
  this.name = "WebAssemblyInInitialChunkError";
103
103
  this.hideStack = true;
104
104
  this.module = module;
105
-
106
- Error.captureStackTrace(this, this.constructor);
107
105
  }
108
106
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webpack",
3
- "version": "5.38.0",
3
+ "version": "5.40.0",
4
4
  "author": "Tobias Koppers @sokra",
5
5
  "description": "Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.",
6
6
  "license": "MIT",
@@ -14,7 +14,7 @@
14
14
  "browserslist": "^4.14.5",
15
15
  "chrome-trace-event": "^1.0.2",
16
16
  "enhanced-resolve": "^5.8.0",
17
- "es-module-lexer": "^0.4.0",
17
+ "es-module-lexer": "^0.6.0",
18
18
  "eslint-scope": "5.1.1",
19
19
  "events": "^3.2.0",
20
20
  "glob-to-regexp": "^0.4.1",
@@ -25,7 +25,7 @@
25
25
  "neo-async": "^2.6.2",
26
26
  "schema-utils": "^3.0.0",
27
27
  "tapable": "^2.1.1",
28
- "terser-webpack-plugin": "^5.1.1",
28
+ "terser-webpack-plugin": "^5.1.3",
29
29
  "watchpack": "^2.2.0",
30
30
  "webpack-sources": "^2.3.0"
31
31
  },
@@ -91,7 +91,7 @@
91
91
  "simple-git": "^2.17.0",
92
92
  "strip-ansi": "^6.0.0",
93
93
  "style-loader": "^2.0.0",
94
- "terser": "^5.5.0",
94
+ "terser": "^5.7.0",
95
95
  "toml": "^3.0.0",
96
96
  "tooling": "webpack/tooling#v1.19.0",
97
97
  "ts-loader": "^8.0.2",
package/types.d.ts CHANGED
@@ -358,6 +358,7 @@ declare abstract class AsyncQueue<T, K, R> {
358
358
  isProcessing(item: T): boolean;
359
359
  isQueued(item: T): boolean;
360
360
  isDone(item: T): boolean;
361
+ clear(): void;
361
362
  }
362
363
  declare class AsyncWebAssemblyModulesPlugin {
363
364
  constructor(options?: any);
@@ -2375,6 +2376,7 @@ declare interface ContextModuleOptions {
2375
2376
  include?: RegExp;
2376
2377
  exclude?: RegExp;
2377
2378
  groupOptions?: RawChunkGroupOptions;
2379
+ typePrefix?: string;
2378
2380
  category?: string;
2379
2381
 
2380
2382
  /**
@@ -5793,11 +5795,13 @@ type LoaderContext<OptionsType> = NormalModuleLoaderContext<OptionsType> &
5793
5795
  LoaderRunnerLoaderContext<OptionsType> &
5794
5796
  LoaderPluginLoaderContext &
5795
5797
  HotModuleReplacementPluginLoaderContext;
5796
- type LoaderDefinition<OptionsType = {}, ContextAdditions = {}> =
5797
- LoaderDefinitionFunction<OptionsType, ContextAdditions> & {
5798
- raw?: false;
5799
- pitch?: PitchLoaderDefinitionFunction<OptionsType, ContextAdditions>;
5800
- };
5798
+ type LoaderDefinition<
5799
+ OptionsType = {},
5800
+ ContextAdditions = {}
5801
+ > = LoaderDefinitionFunction<OptionsType, ContextAdditions> & {
5802
+ raw?: false;
5803
+ pitch?: PitchLoaderDefinitionFunction<OptionsType, ContextAdditions>;
5804
+ };
5801
5805
  declare interface LoaderDefinitionFunction<
5802
5806
  OptionsType = {},
5803
5807
  ContextAdditions = {}
@@ -7202,7 +7206,7 @@ declare interface NormalModuleLoaderContext<OptionsType> {
7202
7206
  };
7203
7207
  emitFile(
7204
7208
  name: string,
7205
- content: string,
7209
+ content: string | Buffer,
7206
7210
  sourceMap?: string,
7207
7211
  assetInfo?: AssetInfo
7208
7212
  ): void;
@@ -8660,11 +8664,13 @@ declare interface RawChunkGroupOptions {
8660
8664
  preloadOrder?: number;
8661
8665
  prefetchOrder?: number;
8662
8666
  }
8663
- type RawLoaderDefinition<OptionsType = {}, ContextAdditions = {}> =
8664
- RawLoaderDefinitionFunction<OptionsType, ContextAdditions> & {
8665
- raw: true;
8666
- pitch?: PitchLoaderDefinitionFunction<OptionsType, ContextAdditions>;
8667
- };
8667
+ type RawLoaderDefinition<
8668
+ OptionsType = {},
8669
+ ContextAdditions = {}
8670
+ > = RawLoaderDefinitionFunction<OptionsType, ContextAdditions> & {
8671
+ raw: true;
8672
+ pitch?: PitchLoaderDefinitionFunction<OptionsType, ContextAdditions>;
8673
+ };
8668
8674
  declare interface RawLoaderDefinitionFunction<
8669
8675
  OptionsType = {},
8670
8676
  ContextAdditions = {}