webpack 5.55.1 → 5.56.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.

@@ -13,7 +13,7 @@ const {
13
13
  evaluateToString,
14
14
  toConstantDependency
15
15
  } = require("./javascript/JavascriptParserHelpers");
16
- const { provide } = require("./util/MapHelpers");
16
+ const createHash = require("./util/createHash");
17
17
 
18
18
  /** @typedef {import("estree").Expression} Expression */
19
19
  /** @typedef {import("./Compiler")} Compiler */
@@ -286,12 +286,11 @@ class DefinePlugin {
286
286
  );
287
287
  const { runtimeTemplate } = compilation;
288
288
 
289
- const mainValue = /** @type {Set<string>} */ (
290
- provide(
291
- compilation.valueCacheVersions,
292
- VALUE_DEP_MAIN,
293
- () => new Set()
294
- )
289
+ const mainHash = createHash(compilation.outputOptions.hashFunction);
290
+ mainHash.update(
291
+ /** @type {string} */ (
292
+ compilation.valueCacheVersions.get(VALUE_DEP_MAIN)
293
+ ) || ""
295
294
  );
296
295
 
297
296
  /**
@@ -300,6 +299,7 @@ class DefinePlugin {
300
299
  * @returns {void}
301
300
  */
302
301
  const handler = parser => {
302
+ const mainValue = compilation.valueCacheVersions.get(VALUE_DEP_MAIN);
303
303
  parser.hooks.program.tap("DefinePlugin", () => {
304
304
  const { buildInfo } = parser.state.module;
305
305
  if (!buildInfo.valueDependencies)
@@ -565,7 +565,7 @@ class DefinePlugin {
565
565
  const code = definitions[key];
566
566
  const version = toCacheVersion(code);
567
567
  const name = VALUE_DEP_PREFIX + prefix + key;
568
- mainValue.add(name);
568
+ mainHash.update("|" + prefix + key);
569
569
  const oldVersion = compilation.valueCacheVersions.get(name);
570
570
  if (oldVersion === undefined) {
571
571
  compilation.valueCacheVersions.set(name, version);
@@ -589,6 +589,11 @@ class DefinePlugin {
589
589
  };
590
590
 
591
591
  walkDefinitionsForValues(definitions, "");
592
+
593
+ compilation.valueCacheVersions.set(
594
+ VALUE_DEP_MAIN,
595
+ /** @type {string} */ (mainHash.digest("hex").slice(0, 8))
596
+ );
592
597
  }
593
598
  );
594
599
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webpack",
3
- "version": "5.55.1",
3
+ "version": "5.56.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",