webpack 5.63.0 → 5.64.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.

@@ -64,6 +64,7 @@ class EntryOptionPlugin {
64
64
  dependOn: desc.dependOn,
65
65
  publicPath: desc.publicPath,
66
66
  chunkLoading: desc.chunkLoading,
67
+ asyncChunks: desc.asyncChunks,
67
68
  wasmLoading: desc.wasmLoading,
68
69
  library: desc.library
69
70
  };
@@ -5,6 +5,7 @@
5
5
 
6
6
  "use strict";
7
7
 
8
+ const { groupBy } = require("./util/ArrayHelpers");
8
9
  const createSchemaValidation = require("./util/create-schema-validation");
9
10
 
10
11
  /** @typedef {import("../declarations/plugins/WatchIgnorePlugin").WatchIgnorePluginOptions} WatchIgnorePluginOptions */
@@ -40,14 +41,12 @@ class IgnoringWatchFileSystem {
40
41
  p instanceof RegExp ? p.test(path) : path.indexOf(p) === 0
41
42
  );
42
43
 
43
- const notIgnored = path => !ignored(path);
44
-
45
- const ignoredFiles = files.filter(ignored);
46
- const ignoredDirs = dirs.filter(ignored);
44
+ const [ignoredFiles, notIgnoredFiles] = groupBy(files, ignored);
45
+ const [ignoredDirs, notIgnoredDirs] = groupBy(dirs, ignored);
47
46
 
48
47
  const watcher = this.wfs.watch(
49
- files.filter(notIgnored),
50
- dirs.filter(notIgnored),
48
+ notIgnoredFiles,
49
+ notIgnoredDirs,
51
50
  missing,
52
51
  startTime,
53
52
  options,
@@ -50,7 +50,8 @@ const { getEntryRuntime, mergeRuntime } = require("./util/runtime");
50
50
  * @property {Set<ChunkGroupInfo>} availableChildren set of chunk groups which depend on the this chunk group as availableSource
51
51
  * @property {number} preOrderIndex next pre order index
52
52
  * @property {number} postOrderIndex next post order index
53
- * @property {boolean} asyncChunkLoading create async chunks
53
+ * @property {boolean} chunkLoading has a chunk loading mechanism
54
+ * @property {boolean} asyncChunks create async chunks
54
55
  */
55
56
 
56
57
  /**
@@ -306,10 +307,14 @@ const visitModules = (
306
307
  availableChildren: undefined,
307
308
  preOrderIndex: 0,
308
309
  postOrderIndex: 0,
309
- asyncChunkLoading:
310
- chunkGroup.options.chunkLoading === false
311
- ? false
312
- : compilation.outputOptions.chunkLoading !== false
310
+ chunkLoading:
311
+ chunkGroup.options.chunkLoading !== undefined
312
+ ? chunkGroup.options.chunkLoading !== false
313
+ : compilation.outputOptions.chunkLoading !== false,
314
+ asyncChunks:
315
+ chunkGroup.options.asyncChunks !== undefined
316
+ ? chunkGroup.options.asyncChunks
317
+ : compilation.outputOptions.asyncChunks !== false
313
318
  };
314
319
  chunkGroup.index = nextChunkGroupIndex++;
315
320
  if (chunkGroup.getNumberOfParents() > 0) {
@@ -424,10 +429,14 @@ const visitModules = (
424
429
  availableChildren: undefined,
425
430
  preOrderIndex: 0,
426
431
  postOrderIndex: 0,
427
- asyncChunkLoading:
432
+ chunkLoading:
428
433
  entryOptions.chunkLoading !== undefined
429
434
  ? entryOptions.chunkLoading !== false
430
- : chunkGroupInfo.asyncChunkLoading
435
+ : chunkGroupInfo.chunkLoading,
436
+ asyncChunks:
437
+ entryOptions.asyncChunks !== undefined
438
+ ? entryOptions.asyncChunks
439
+ : chunkGroupInfo.asyncChunks
431
440
  };
432
441
  chunkGroupInfoMap.set(entrypoint, cgi);
433
442
 
@@ -451,7 +460,7 @@ const visitModules = (
451
460
  chunkGroup: entrypoint,
452
461
  chunkGroupInfo: cgi
453
462
  });
454
- } else if (!chunkGroupInfo.asyncChunkLoading) {
463
+ } else if (!chunkGroupInfo.asyncChunks || !chunkGroupInfo.chunkLoading) {
455
464
  // Just queue the block into the current chunk group
456
465
  queue.push({
457
466
  action: PROCESS_BLOCK,
@@ -484,7 +493,8 @@ const visitModules = (
484
493
  availableChildren: undefined,
485
494
  preOrderIndex: 0,
486
495
  postOrderIndex: 0,
487
- asyncChunkLoading: chunkGroupInfo.asyncChunkLoading
496
+ chunkLoading: chunkGroupInfo.chunkLoading,
497
+ asyncChunks: chunkGroupInfo.asyncChunks
488
498
  };
489
499
  allCreatedChunkGroups.add(c);
490
500
  chunkGroupInfoMap.set(c, cgi);
@@ -744,6 +744,7 @@ const applyOutputDefaults = (
744
744
  "Chunk format can't be selected by default when no target is specified"
745
745
  );
746
746
  });
747
+ D(output, "asyncChunks", true);
747
748
  F(output, "chunkLoading", () => {
748
749
  if (tp) {
749
750
  switch (output.chunkFormat) {
@@ -290,6 +290,7 @@ const getNormalizedWebpackOptions = config => {
290
290
  /** @type {OutputNormalized} */
291
291
  const result = {
292
292
  assetModuleFilename: output.assetModuleFilename,
293
+ asyncChunks: output.asyncChunks,
293
294
  charset: output.charset,
294
295
  chunkFilename: output.chunkFilename,
295
296
  chunkFormat: output.chunkFormat,
@@ -484,6 +485,7 @@ const getNormalizedEntryStatic = entry => {
484
485
  runtime: value.runtime,
485
486
  publicPath: value.publicPath,
486
487
  chunkLoading: value.chunkLoading,
488
+ asyncChunks: value.asyncChunks,
487
489
  wasmLoading: value.wasmLoading,
488
490
  dependOn:
489
491
  value.dependOn &&
@@ -203,15 +203,17 @@ class ProfilingPlugin {
203
203
 
204
204
  // Compiler Hooks
205
205
  Object.keys(compiler.hooks).forEach(hookName => {
206
- compiler.hooks[hookName].intercept(
207
- makeInterceptorFor("Compiler", tracer)(hookName)
208
- );
206
+ const hook = compiler.hooks[hookName];
207
+ if (hook) {
208
+ hook.intercept(makeInterceptorFor("Compiler", tracer)(hookName));
209
+ }
209
210
  });
210
211
 
211
212
  Object.keys(compiler.resolverFactory.hooks).forEach(hookName => {
212
- compiler.resolverFactory.hooks[hookName].intercept(
213
- makeInterceptorFor("Resolver", tracer)(hookName)
214
- );
213
+ const hook = compiler.resolverFactory.hooks[hookName];
214
+ if (hook) {
215
+ hook.intercept(makeInterceptorFor("Resolver", tracer)(hookName));
216
+ }
215
217
  });
216
218
 
217
219
  compiler.hooks.compilation.tap(
@@ -303,7 +305,7 @@ const interceptAllHooksFor = (instance, tracer, logLabel) => {
303
305
  if (Reflect.has(instance, "hooks")) {
304
306
  Object.keys(instance.hooks).forEach(hookName => {
305
307
  const hook = instance.hooks[hookName];
306
- if (!hook._fakeHook) {
308
+ if (hook && !hook._fakeHook) {
307
309
  hook.intercept(makeInterceptorFor(logLabel, tracer)(hookName));
308
310
  }
309
311
  });
@@ -12,3 +12,19 @@ exports.equals = (a, b) => {
12
12
  }
13
13
  return true;
14
14
  };
15
+
16
+ /**
17
+ *
18
+ * @param {Array} arr Array of values to be partitioned
19
+ * @param {(value: any) => boolean} fn Partition function which partitions based on truthiness of result.
20
+ * @returns {[Array, Array]} returns the values of `arr` partitioned into two new arrays based on fn predicate.
21
+ */
22
+ exports.groupBy = (arr = [], fn) => {
23
+ return arr.reduce(
24
+ (groups, value) => {
25
+ groups[fn(value) ? 0 : 1].push(value);
26
+ return groups;
27
+ },
28
+ [[], []]
29
+ );
30
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webpack",
3
- "version": "5.63.0",
3
+ "version": "5.64.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",