webpack 5.37.1 → 5.39.1

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 (68) hide show
  1. package/bin/webpack.js +20 -5
  2. package/lib/AsyncDependencyToInitialChunkError.js +0 -2
  3. package/lib/CaseSensitiveModulesWarning.js +0 -2
  4. package/lib/Chunk.js +6 -2
  5. package/lib/ChunkRenderError.js +0 -2
  6. package/lib/CodeGenerationError.js +0 -2
  7. package/lib/CommentCompilationWarning.js +0 -2
  8. package/lib/Compilation.js +43 -28
  9. package/lib/Compiler.js +3 -0
  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/EntryPlugin.js +3 -3
  15. package/lib/ExportsInfo.js +20 -13
  16. package/lib/HarmonyLinkingError.js +0 -2
  17. package/lib/HookWebpackError.js +0 -1
  18. package/lib/HotModuleReplacementPlugin.js +7 -2
  19. package/lib/InvalidDependenciesModuleWarning.js +0 -2
  20. package/lib/ModuleBuildError.js +0 -2
  21. package/lib/ModuleDependencyError.js +0 -2
  22. package/lib/ModuleDependencyWarning.js +0 -2
  23. package/lib/ModuleError.js +0 -2
  24. package/lib/ModuleNotFoundError.js +0 -2
  25. package/lib/ModuleParseError.js +0 -2
  26. package/lib/ModuleRestoreError.js +0 -2
  27. package/lib/ModuleStoreError.js +0 -2
  28. package/lib/ModuleWarning.js +0 -2
  29. package/lib/NoModeWarning.js +0 -2
  30. package/lib/NormalModule.js +4 -3
  31. package/lib/NormalModuleFactory.js +2 -0
  32. package/lib/UnsupportedFeatureWarning.js +0 -2
  33. package/lib/WarnDeprecatedOptionPlugin.js +0 -2
  34. package/lib/Watching.js +21 -14
  35. package/lib/WebpackError.js +0 -2
  36. package/lib/asset/AssetGenerator.js +27 -6
  37. package/lib/asset/AssetModulesPlugin.js +1 -1
  38. package/lib/cache/PackFileCacheStrategy.js +3 -0
  39. package/lib/config/defaults.js +9 -1
  40. package/lib/config/normalization.js +1 -0
  41. package/lib/config/target.js +7 -2
  42. package/lib/dependencies/ContextElementDependency.js +6 -1
  43. package/lib/dependencies/CriticalDependencyWarning.js +0 -2
  44. package/lib/dependencies/ImportParserPlugin.js +1 -0
  45. package/lib/dependencies/RequireIncludeDependencyParserPlugin.js +0 -2
  46. package/lib/dependencies/SystemPlugin.js +0 -2
  47. package/lib/errors/BuildCycleError.js +0 -1
  48. package/lib/hmr/LazyCompilationPlugin.js +3 -1
  49. package/lib/node/NodeEnvironmentPlugin.js +1 -0
  50. package/lib/optimize/ConcatenatedModule.js +9 -0
  51. package/lib/performance/AssetsOverSizeLimitWarning.js +0 -2
  52. package/lib/performance/EntrypointsOverSizeLimitWarning.js +0 -2
  53. package/lib/performance/NoAsyncChunksWarning.js +0 -2
  54. package/lib/schemes/DataUriPlugin.js +21 -2
  55. package/lib/serialization/BinaryMiddleware.js +3 -0
  56. package/lib/serialization/SerializerMiddleware.js +19 -0
  57. package/lib/stats/DefaultStatsFactoryPlugin.js +5 -4
  58. package/lib/util/ArrayQueue.js +8 -0
  59. package/lib/util/AsyncQueue.js +9 -0
  60. package/lib/util/createHash.js +5 -4
  61. package/lib/util/serialization.js +108 -59
  62. package/lib/wasm-sync/UnsupportedWebAssemblyFeatureError.js +0 -2
  63. package/lib/wasm-sync/WebAssemblyInInitialChunkError.js +0 -2
  64. package/package.json +4 -4
  65. package/schemas/WebpackOptions.check.js +1 -1
  66. package/schemas/WebpackOptions.json +8 -0
  67. package/types.d.ts +24 -5
  68. package/lib/util/DataURI.js +0 -32
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
  });
package/lib/Compiler.js CHANGED
@@ -230,6 +230,8 @@ class Compiler {
230
230
  this.fileTimestamps = undefined;
231
231
  /** @type {Map<string, FileSystemInfoEntry | "ignore" | null>} */
232
232
  this.contextTimestamps = undefined;
233
+ /** @type {number} */
234
+ this.fsStartTime = undefined;
233
235
 
234
236
  /** @type {ResolverFactory} */
235
237
  this.resolverFactory = new ResolverFactory();
@@ -952,6 +954,7 @@ ${other}`);
952
954
  childCompiler.removedFiles = this.removedFiles;
953
955
  childCompiler.fileTimestamps = this.fileTimestamps;
954
956
  childCompiler.contextTimestamps = this.contextTimestamps;
957
+ childCompiler.fsStartTime = this.fsStartTime;
955
958
  childCompiler.cache = this.cache;
956
959
  childCompiler.compilerPath = `${this.compilerPath}${compilerName}|${compilerIndex}|`;
957
960
 
@@ -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
 
@@ -41,10 +41,10 @@ class EntryPlugin {
41
41
  }
42
42
  );
43
43
 
44
- compiler.hooks.make.tapAsync("EntryPlugin", (compilation, callback) => {
45
- const { entry, options, context } = this;
44
+ const { entry, options, context } = this;
45
+ const dep = EntryPlugin.createDependency(entry, options);
46
46
 
47
- const dep = EntryPlugin.createDependency(entry, options);
47
+ compiler.hooks.make.tapAsync("EntryPlugin", (compilation, callback) => {
48
48
  compilation.addEntry(context, dep, options, err => {
49
49
  callback(err);
50
50
  });
@@ -137,18 +137,22 @@ class ExportsInfo {
137
137
 
138
138
  _sortExportsMap(exports) {
139
139
  if (exports.size > 1) {
140
- const entriesInOrder = Array.from(exports.values());
141
- if (
142
- entriesInOrder.length !== 2 ||
143
- entriesInOrder[0].name > entriesInOrder[1].name
144
- ) {
145
- entriesInOrder.sort((a, b) => {
146
- return a.name < b.name ? -1 : 1;
147
- });
148
- exports.clear();
149
- for (const entry of entriesInOrder) {
150
- exports.set(entry.name, entry);
151
- }
140
+ const namesInOrder = [];
141
+ for (const entry of exports.values()) {
142
+ namesInOrder.push(entry.name);
143
+ }
144
+ namesInOrder.sort();
145
+ let i = 0;
146
+ for (const entry of exports.values()) {
147
+ const name = namesInOrder[i];
148
+ if (entry.name !== name) break;
149
+ i++;
150
+ }
151
+ for (; i < namesInOrder.length; i++) {
152
+ const name = namesInOrder[i];
153
+ const correctEntry = exports.get(name);
154
+ exports.delete(name);
155
+ exports.set(name, correctEntry);
152
156
  }
153
157
  }
154
158
  }
@@ -722,7 +726,7 @@ class ExportsInfo {
722
726
  const otherCanMangleProvide = this._otherExportsInfo.canMangleProvide;
723
727
  const otherTerminalBinding = this._otherExportsInfo.terminalBinding;
724
728
  const exports = [];
725
- for (const exportInfo of this._exports.values()) {
729
+ for (const exportInfo of this.orderedExports) {
726
730
  if (
727
731
  exportInfo.provided !== otherProvided ||
728
732
  exportInfo.canMangleProvide !== otherCanMangleProvide ||
@@ -754,7 +758,9 @@ class ExportsInfo {
754
758
  otherTerminalBinding,
755
759
  exports
756
760
  }) {
761
+ let wasEmpty = true;
757
762
  for (const exportInfo of this._exports.values()) {
763
+ wasEmpty = false;
758
764
  exportInfo.provided = otherProvided;
759
765
  exportInfo.canMangleProvide = otherCanMangleProvide;
760
766
  exportInfo.terminalBinding = otherTerminalBinding;
@@ -772,6 +778,7 @@ class ExportsInfo {
772
778
  exportsInfo.restoreProvided(exp.exportsInfo);
773
779
  }
774
780
  }
781
+ if (wasEmpty) this._exportsAreOrdered = true;
775
782
  }
776
783
  }
777
784
 
@@ -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
  }
@@ -31,7 +31,8 @@ const {
31
31
  keyToRuntime,
32
32
  forEachRuntime,
33
33
  mergeRuntimeOwned,
34
- subtractRuntime
34
+ subtractRuntime,
35
+ intersectRuntime
35
36
  } = require("./util/runtime");
36
37
 
37
38
  /** @typedef {import("./Chunk")} Chunk */
@@ -502,7 +503,11 @@ class HotModuleReplacementPlugin {
502
503
  );
503
504
  if (currentChunk) {
504
505
  chunkId = currentChunk.id;
505
- newRuntime = currentChunk.runtime;
506
+ newRuntime = intersectRuntime(
507
+ currentChunk.runtime,
508
+ allOldRuntime
509
+ );
510
+ if (newRuntime === undefined) continue;
506
511
  newModules = chunkGraph
507
512
  .getChunkModules(currentChunk)
508
513
  .filter(module => updatedModules.has(module, currentChunk));
@@ -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
 
@@ -219,6 +217,7 @@ class NormalModule extends Module {
219
217
  * @param {string} options.rawRequest request without resolving
220
218
  * @param {LoaderItem[]} options.loaders list of loaders
221
219
  * @param {string} options.resource path + query of the real resource
220
+ * @param {Record<string, any>=} options.resourceResolveData resource resolve data
222
221
  * @param {string | undefined} options.matchResource path + query of the matched resource (virtual)
223
222
  * @param {Parser} options.parser the parser used
224
223
  * @param {object} options.parserOptions the options of the parser used
@@ -234,6 +233,7 @@ class NormalModule extends Module {
234
233
  rawRequest,
235
234
  loaders,
236
235
  resource,
236
+ resourceResolveData,
237
237
  matchResource,
238
238
  parser,
239
239
  parserOptions,
@@ -260,6 +260,7 @@ class NormalModule extends Module {
260
260
  this.generatorOptions = generatorOptions;
261
261
  /** @type {string} */
262
262
  this.resource = resource;
263
+ this.resourceResolveData = resourceResolveData;
263
264
  /** @type {string | undefined} */
264
265
  this.matchResource = matchResource;
265
266
  /** @type {LoaderItem[]} */
@@ -902,7 +903,7 @@ class NormalModule extends Module {
902
903
  assetsInfo: undefined
903
904
  };
904
905
 
905
- const startTime = Date.now();
906
+ const startTime = compilation.compiler.fsStartTime || Date.now();
906
907
 
907
908
  return this.doBuild(options, compilation, resolver, fs, err => {
908
909
  // if we have an error mark module as failed and exit
@@ -168,6 +168,7 @@ const unsafeCacheData = new WeakMap();
168
168
 
169
169
  const ruleSetCompiler = new RuleSetCompiler([
170
170
  new BasicMatcherRulePlugin("test", "resource"),
171
+ new BasicMatcherRulePlugin("scheme"),
171
172
  new BasicMatcherRulePlugin("mimetype"),
172
173
  new BasicMatcherRulePlugin("dependency"),
173
174
  new BasicMatcherRulePlugin("include", "resource"),
@@ -443,6 +444,7 @@ class NormalModuleFactory extends ModuleFactory {
443
444
  realResource: resourceData.path,
444
445
  resourceQuery: resourceDataForRules.query,
445
446
  resourceFragment: resourceDataForRules.fragment,
447
+ scheme,
446
448
  mimetype: matchResourceData ? "" : resourceData.data.mimetype || "",
447
449
  dependency: dependencyType,
448
450
  descriptionData: matchResourceData
@@ -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