webpack 5.62.2 → 5.63.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.

@@ -692,6 +692,11 @@ class SnapshotOptimization {
692
692
  }
693
693
  }
694
694
 
695
+ const parseString = str => {
696
+ if (str[0] === "'") str = `"${str.slice(1, -1).replace(/"/g, '\\"')}"`;
697
+ return JSON.parse(str);
698
+ };
699
+
695
700
  /* istanbul ignore next */
696
701
  /**
697
702
  * @param {number} mtime mtime
@@ -1657,17 +1662,13 @@ class FileSystemInfo {
1657
1662
  let dependency;
1658
1663
  if (imp.d === -1) {
1659
1664
  // import ... from "..."
1660
- dependency = JSON.parse(
1665
+ dependency = parseString(
1661
1666
  source.substring(imp.s - 1, imp.e + 1)
1662
1667
  );
1663
1668
  } else if (imp.d > -1) {
1664
1669
  // import()
1665
1670
  let expr = source.substring(imp.s, imp.e).trim();
1666
- if (expr[0] === "'")
1667
- expr = `"${expr
1668
- .slice(1, -1)
1669
- .replace(/"/g, '\\"')}"`;
1670
- dependency = JSON.parse(expr);
1671
+ dependency = parseString(expr);
1671
1672
  } else {
1672
1673
  // e.g. import.meta
1673
1674
  continue;
@@ -50,6 +50,7 @@ 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
54
  */
54
55
 
55
56
  /**
@@ -304,7 +305,11 @@ const visitModules = (
304
305
  availableSources: undefined,
305
306
  availableChildren: undefined,
306
307
  preOrderIndex: 0,
307
- postOrderIndex: 0
308
+ postOrderIndex: 0,
309
+ asyncChunkLoading:
310
+ chunkGroup.options.chunkLoading === false
311
+ ? false
312
+ : compilation.outputOptions.chunkLoading !== false
308
313
  };
309
314
  chunkGroup.index = nextChunkGroupIndex++;
310
315
  if (chunkGroup.getNumberOfParents() > 0) {
@@ -418,7 +423,11 @@ const visitModules = (
418
423
  availableSources: undefined,
419
424
  availableChildren: undefined,
420
425
  preOrderIndex: 0,
421
- postOrderIndex: 0
426
+ postOrderIndex: 0,
427
+ asyncChunkLoading:
428
+ entryOptions.chunkLoading !== undefined
429
+ ? entryOptions.chunkLoading !== false
430
+ : chunkGroupInfo.asyncChunkLoading
422
431
  };
423
432
  chunkGroupInfoMap.set(entrypoint, cgi);
424
433
 
@@ -442,8 +451,18 @@ const visitModules = (
442
451
  chunkGroup: entrypoint,
443
452
  chunkGroupInfo: cgi
444
453
  });
454
+ } else if (!chunkGroupInfo.asyncChunkLoading) {
455
+ // Just queue the block into the current chunk group
456
+ queue.push({
457
+ action: PROCESS_BLOCK,
458
+ block: b,
459
+ module: module,
460
+ chunk,
461
+ chunkGroup,
462
+ chunkGroupInfo
463
+ });
445
464
  } else {
446
- cgi = namedChunkGroups.get(chunkName);
465
+ cgi = chunkName && namedChunkGroups.get(chunkName);
447
466
  if (!cgi) {
448
467
  c = compilation.addChunkInGroup(
449
468
  b.groupOptions || b.chunkName,
@@ -464,7 +483,8 @@ const visitModules = (
464
483
  availableSources: undefined,
465
484
  availableChildren: undefined,
466
485
  preOrderIndex: 0,
467
- postOrderIndex: 0
486
+ postOrderIndex: 0,
487
+ asyncChunkLoading: chunkGroupInfo.asyncChunkLoading
468
488
  };
469
489
  allCreatedChunkGroups.add(c);
470
490
  chunkGroupInfoMap.set(c, cgi);
@@ -518,7 +538,7 @@ const visitModules = (
518
538
  chunkGroup: c,
519
539
  chunkGroupInfo: cgi
520
540
  });
521
- } else {
541
+ } else if (entrypoint !== undefined) {
522
542
  chunkGroupInfo.chunkGroup.addAsyncEntrypoint(entrypoint);
523
543
  }
524
544
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webpack",
3
- "version": "5.62.2",
3
+ "version": "5.63.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",