webpack 5.73.0 → 5.74.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.

package/README.md CHANGED
@@ -15,8 +15,8 @@
15
15
  [![PR's welcome][prs]][prs-url]
16
16
 
17
17
  <br>
18
- <a href="https://dependabot.com/compatibility-score.html?dependency-name=webpack&package-manager=npm_and_yarn&new-version=latest">
19
- <img src="https://api.dependabot.com/badges/compatibility_score?dependency-name=webpack&package-manager=npm_and_yarn&version-scheme=semver&target-version=latest">
18
+ <a href="https://docs.github.com/en/code-security/dependabot/dependabot-security-updates/about-dependabot-security-updates#about-compatibility-scores">
19
+ <img src="https://api.dependabot.com/badges/compatibility_score?dependency-name=webpack&package-manager=npm_and_yarn&previous-version=5.72.1&new-version=5.73.0">
20
20
  </a>
21
21
  <a href="https://npmcharts.com/compare/webpack?minimal=true">
22
22
  <img src="https://img.shields.io/npm/dm/webpack.svg">
@@ -110,6 +110,7 @@ within webpack itself use this plugin interface. This makes webpack very
110
110
  | [mini-css-extract-plugin][mini-css] | ![mini-css-npm] | ![mini-css-size] | Extracts CSS into separate files. It creates a CSS file per JS file which contains CSS. |
111
111
  | [compression-webpack-plugin][compression] | ![compression-npm] | ![compression-size] | Prepares compressed versions of assets to serve them with Content-Encoding |
112
112
  | [html-webpack-plugin][html-plugin] | ![html-plugin-npm] | ![html-plugin-size] | Simplifies creation of HTML files (`index.html`) to serve your bundles |
113
+ | [pug-plugin][pug-plugin] | ![pug-plugin-npm] | ![pug-plugin-size] | Renders Pug files to HTML, extracts JS and CSS from sources specified directly in Pug. |
113
114
 
114
115
  [common-npm]: https://img.shields.io/npm/v/webpack.svg
115
116
  [mini-css]: https://github.com/webpack-contrib/mini-css-extract-plugin
@@ -124,6 +125,9 @@ within webpack itself use this plugin interface. This makes webpack very
124
125
  [html-plugin]: https://github.com/jantimon/html-webpack-plugin
125
126
  [html-plugin-npm]: https://img.shields.io/npm/v/html-webpack-plugin.svg
126
127
  [html-plugin-size]: https://packagephobia.com/badge?p=html-webpack-plugin
128
+ [pug-plugin]: https://github.com/webdiscus/pug-plugin
129
+ [pug-plugin-npm]: https://img.shields.io/npm/v/pug-plugin.svg
130
+ [pug-plugin-size]: https://packagephobia.com/badge?p=pug-plugin
127
131
 
128
132
  ### [Loaders](https://webpack.js.org/loaders/)
129
133
 
@@ -170,18 +174,21 @@ or are automatically applied via regex from your webpack configuration.
170
174
 
171
175
  #### Templating
172
176
 
173
- | Name | Status | Install Size | Description |
174
- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-------------: | :--------------: | :-------------------------------------------------------------------------------------- |
175
- | <a href="https://github.com/webpack-contrib/html-loader"><img width="48" height="48" src="https://worldvectorlogo.com/logos/html5.svg"></a> | ![html-npm] | ![html-size] | Exports HTML as string, requires references to static resources |
176
- | <a href="https://github.com/pugjs/pug-loader"><img width="48" height="48" src="https://cdn.rawgit.com/pugjs/pug-logo/master/SVG/pug-final-logo-_-colour-128.svg"></a> | ![pug-npm] | ![pug-size] | Loads Pug templates and returns a function |
177
- | <a href="https://github.com/peerigon/markdown-loader"><img width="48" height="48" src="https://worldvectorlogo.com/logos/markdown.svg"></a> | ![md-npm] | ![md-size] | Compiles Markdown to HTML |
178
- | <a href="https://github.com/posthtml/posthtml-loader"><img width="48" height="48" src="https://posthtml.github.io/posthtml/logo.svg"></a> | ![posthtml-npm] | ![posthtml-size] | Loads and transforms a HTML file using [PostHTML](https://github.com/posthtml/posthtml) |
179
- | <a href="https://github.com/pcardune/handlebars-loader"><img width="48" height="48" src="https://worldvectorlogo.com/logos/handlebars-1.svg"></a> | ![hbs-npm] | ![hbs-size] | Compiles Handlebars to HTML |
177
+ | Name | Status | Install Size | Description |
178
+ | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-------------: | :--------------: | :-------------------------------------------------------------------------------------- |
179
+ | <a href="https://github.com/webpack-contrib/html-loader"><img width="48" height="48" src="https://worldvectorlogo.com/logos/html5.svg"></a> | ![html-npm] | ![html-size] | Exports HTML as string, requires references to static resources |
180
+ | <a href="https://github.com/pugjs/pug-loader"><img width="48" height="48" src="https://cdn.rawgit.com/pugjs/pug-logo/master/SVG/pug-final-logo-_-colour-128.svg"></a> | ![pug-npm] | ![pug-size] | Loads Pug templates and returns a function |
181
+ | <a href="https://github.com/webdiscus/pug-loader"><img width="48" height="48" src="https://cdn.rawgit.com/pugjs/pug-logo/master/SVG/pug-final-logo-_-colour-128.svg"></a> | ![pug3-npm] | ![pug3-size] | Compiles Pug to a function or HTML string, useful for use with Vue, React, Angular |
182
+ | <a href="https://github.com/peerigon/markdown-loader"><img width="48" height="48" src="https://worldvectorlogo.com/logos/markdown.svg"></a> | ![md-npm] | ![md-size] | Compiles Markdown to HTML |
183
+ | <a href="https://github.com/posthtml/posthtml-loader"><img width="48" height="48" src="https://posthtml.github.io/posthtml/logo.svg"></a> | ![posthtml-npm] | ![posthtml-size] | Loads and transforms a HTML file using [PostHTML](https://github.com/posthtml/posthtml) |
184
+ | <a href="https://github.com/pcardune/handlebars-loader"><img width="48" height="48" src="https://worldvectorlogo.com/logos/handlebars-1.svg"></a> | ![hbs-npm] | ![hbs-size] | Compiles Handlebars to HTML |
180
185
 
181
186
  [html-npm]: https://img.shields.io/npm/v/html-loader.svg
182
187
  [html-size]: https://packagephobia.com/badge?p=html-loader
183
188
  [pug-npm]: https://img.shields.io/npm/v/pug-loader.svg
184
189
  [pug-size]: https://packagephobia.com/badge?p=pug-loader
190
+ [pug3-npm]: https://img.shields.io/npm/v/@webdiscus/pug-loader.svg
191
+ [pug3-size]: https://packagephobia.com/badge?p=@webdiscus/pug-loader
185
192
  [jade-npm]: https://img.shields.io/npm/v/jade-loader.svg
186
193
  [jade-size]: https://packagephobia.com/badge?p=jade-loader
187
194
  [md-npm]: https://img.shields.io/npm/v/markdown-loader.svg
@@ -8,6 +8,7 @@
8
8
  const { create: createResolver } = require("enhanced-resolve");
9
9
  const nodeModule = require("module");
10
10
  const asyncLib = require("neo-async");
11
+ const { isAbsolute } = require("path");
11
12
  const AsyncQueue = require("./util/AsyncQueue");
12
13
  const StackedCacheMap = require("./util/StackedCacheMap");
13
14
  const createHash = require("./util/createHash");
@@ -207,6 +208,12 @@ class SnapshotIterable {
207
208
  class Snapshot {
208
209
  constructor() {
209
210
  this._flags = 0;
211
+ /** @type {Iterable<string> | undefined} */
212
+ this._cachedFileIterable = undefined;
213
+ /** @type {Iterable<string> | undefined} */
214
+ this._cachedContextIterable = undefined;
215
+ /** @type {Iterable<string> | undefined} */
216
+ this._cachedMissingIterable = undefined;
210
217
  /** @type {number | undefined} */
211
218
  this.startTime = undefined;
212
219
  /** @type {Map<string, FileSystemInfoEntry | null> | undefined} */
@@ -417,31 +424,43 @@ class Snapshot {
417
424
  * @returns {Iterable<string>} iterable
418
425
  */
419
426
  getFileIterable() {
420
- return this._createIterable(s => [
421
- s.fileTimestamps,
422
- s.fileHashes,
423
- s.fileTshs,
424
- s.managedFiles
425
- ]);
427
+ if (this._cachedFileIterable === undefined) {
428
+ this._cachedFileIterable = this._createIterable(s => [
429
+ s.fileTimestamps,
430
+ s.fileHashes,
431
+ s.fileTshs,
432
+ s.managedFiles
433
+ ]);
434
+ }
435
+ return this._cachedFileIterable;
426
436
  }
427
437
 
428
438
  /**
429
439
  * @returns {Iterable<string>} iterable
430
440
  */
431
441
  getContextIterable() {
432
- return this._createIterable(s => [
433
- s.contextTimestamps,
434
- s.contextHashes,
435
- s.contextTshs,
436
- s.managedContexts
437
- ]);
442
+ if (this._cachedContextIterable === undefined) {
443
+ this._cachedContextIterable = this._createIterable(s => [
444
+ s.contextTimestamps,
445
+ s.contextHashes,
446
+ s.contextTshs,
447
+ s.managedContexts
448
+ ]);
449
+ }
450
+ return this._cachedContextIterable;
438
451
  }
439
452
 
440
453
  /**
441
454
  * @returns {Iterable<string>} iterable
442
455
  */
443
456
  getMissingIterable() {
444
- return this._createIterable(s => [s.missingExistence, s.managedMissing]);
457
+ if (this._cachedMissingIterable === undefined) {
458
+ this._cachedMissingIterable = this._createIterable(s => [
459
+ s.missingExistence,
460
+ s.managedMissing
461
+ ]);
462
+ }
463
+ return this._cachedMissingIterable;
445
464
  }
446
465
  }
447
466
 
@@ -1633,7 +1652,9 @@ class FileSystemInfo {
1633
1652
  let request = relative(this.fs, context, childPath);
1634
1653
  if (request.endsWith(".js")) request = request.slice(0, -3);
1635
1654
  request = request.replace(/\\/g, "/");
1636
- if (!request.startsWith("../")) request = `./${request}`;
1655
+ if (!request.startsWith("../") && !isAbsolute(request)) {
1656
+ request = `./${request}`;
1657
+ }
1637
1658
  push({
1638
1659
  type: RBDT_RESOLVE_CJS_FILE,
1639
1660
  context,
@@ -117,7 +117,7 @@ class NodeStuffPlugin {
117
117
  setConstant(
118
118
  "__filename",
119
119
  "/index.js",
120
- "The __filename is Node.js feature and doesn't present in browser."
120
+ "__filename is a Node.js feature and isn't available in browsers."
121
121
  );
122
122
  break;
123
123
  case true:
@@ -144,7 +144,7 @@ class NodeStuffPlugin {
144
144
  setConstant(
145
145
  "__dirname",
146
146
  "/",
147
- "The __dirname is Node.js feature and doesn't present in browser."
147
+ "__dirname is a Node.js feature and isn't available in browsers."
148
148
  );
149
149
  break;
150
150
  case true:
@@ -65,6 +65,7 @@ class ModuleFederationPlugin {
65
65
  library,
66
66
  filename: options.filename,
67
67
  runtime: options.runtime,
68
+ shareScope: options.shareScope,
68
69
  exposes: options.exposes
69
70
  }).apply(compiler);
70
71
  }
@@ -76,6 +77,7 @@ class ModuleFederationPlugin {
76
77
  ) {
77
78
  new ContainerReferencePlugin({
78
79
  remoteType,
80
+ shareScope: options.shareScope,
79
81
  remotes: options.remotes
80
82
  }).apply(compiler);
81
83
  }
@@ -108,13 +108,15 @@ class CssLoadingRuntimeModule extends RuntimeModule {
108
108
  'link.rel = "stylesheet";',
109
109
  "link.href = url;",
110
110
  crossOriginLoading
111
- ? Template.asString([
112
- "if (link.src.indexOf(window.location.origin + '/') !== 0) {",
113
- Template.indent(
114
- `link.crossOrigin = ${JSON.stringify(crossOriginLoading)};`
115
- ),
116
- "}"
117
- ])
111
+ ? crossOriginLoading === "use-credentials"
112
+ ? 'link.crossOrigin = "use-credentials";'
113
+ : Template.asString([
114
+ "if (link.src.indexOf(window.location.origin + '/') !== 0) {",
115
+ Template.indent(
116
+ `link.crossOrigin = ${JSON.stringify(crossOriginLoading)};`
117
+ ),
118
+ "}"
119
+ ])
118
120
  : ""
119
121
  ]);
120
122
 
@@ -5,19 +5,21 @@
5
5
 
6
6
  "use strict";
7
7
 
8
+ const Dependency = require("../Dependency");
8
9
  const InitFragment = require("../InitFragment");
9
10
  const makeSerializable = require("../util/makeSerializable");
10
11
  const ModuleDependency = require("./ModuleDependency");
11
12
 
12
13
  /** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
13
14
  /** @typedef {import("../ChunkGraph")} ChunkGraph */
14
- /** @typedef {import("../Dependency")} Dependency */
15
+ /** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */
15
16
  /** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */
16
17
  /** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
17
18
  /** @typedef {import("../DependencyTemplates")} DependencyTemplates */
18
19
  /** @typedef {import("../ModuleGraph")} ModuleGraph */
19
20
  /** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */
20
21
  /** @typedef {import("../util/Hash")} Hash */
22
+ /** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */
21
23
 
22
24
  /**
23
25
  * @param {string[]|null} path the property path array
@@ -29,10 +31,16 @@ const pathToString = path =>
29
31
  : "";
30
32
 
31
33
  class ProvidedDependency extends ModuleDependency {
32
- constructor(request, identifier, path, range) {
34
+ /**
35
+ * @param {string} request request
36
+ * @param {string} identifier identifier
37
+ * @param {string[]} ids ids
38
+ * @param {[number, number]} range range
39
+ */
40
+ constructor(request, identifier, ids, range) {
33
41
  super(request);
34
42
  this.identifier = identifier;
35
- this.path = path;
43
+ this.ids = ids;
36
44
  this.range = range;
37
45
  this._hashUpdate = undefined;
38
46
  }
@@ -45,6 +53,18 @@ class ProvidedDependency extends ModuleDependency {
45
53
  return "esm";
46
54
  }
47
55
 
56
+ /**
57
+ * Returns list of exports referenced by this dependency
58
+ * @param {ModuleGraph} moduleGraph module graph
59
+ * @param {RuntimeSpec} runtime the runtime for which the module is analysed
60
+ * @returns {(string[] | ReferencedExport)[]} referenced exports
61
+ */
62
+ getReferencedExports(moduleGraph, runtime) {
63
+ let ids = this.ids;
64
+ if (ids.length === 0) return Dependency.EXPORTS_OBJECT_REFERENCED;
65
+ return [ids];
66
+ }
67
+
48
68
  /**
49
69
  * Update the hash
50
70
  * @param {Hash} hash hash to be updated
@@ -53,8 +73,7 @@ class ProvidedDependency extends ModuleDependency {
53
73
  */
54
74
  updateHash(hash, context) {
55
75
  if (this._hashUpdate === undefined) {
56
- this._hashUpdate =
57
- this.identifier + (this.path ? this.path.join(",") : "null");
76
+ this._hashUpdate = this.identifier + (this.ids ? this.ids.join(",") : "");
58
77
  }
59
78
  hash.update(this._hashUpdate);
60
79
  }
@@ -62,14 +81,14 @@ class ProvidedDependency extends ModuleDependency {
62
81
  serialize(context) {
63
82
  const { write } = context;
64
83
  write(this.identifier);
65
- write(this.path);
84
+ write(this.ids);
66
85
  super.serialize(context);
67
86
  }
68
87
 
69
88
  deserialize(context) {
70
89
  const { read } = context;
71
90
  this.identifier = read();
72
- this.path = read();
91
+ this.ids = read();
73
92
  super.deserialize(context);
74
93
  }
75
94
  }
@@ -90,6 +109,7 @@ class ProvidedDependencyTemplate extends ModuleDependency.Template {
90
109
  dependency,
91
110
  source,
92
111
  {
112
+ runtime,
93
113
  runtimeTemplate,
94
114
  moduleGraph,
95
115
  chunkGraph,
@@ -98,6 +118,9 @@ class ProvidedDependencyTemplate extends ModuleDependency.Template {
98
118
  }
99
119
  ) {
100
120
  const dep = /** @type {ProvidedDependency} */ (dependency);
121
+ const connection = moduleGraph.getConnection(dep);
122
+ const exportsInfo = moduleGraph.getExportsInfo(connection.module);
123
+ const usedName = exportsInfo.getUsedName(dep.ids, runtime);
101
124
  initFragments.push(
102
125
  new InitFragment(
103
126
  `/* provided dependency */ var ${
@@ -107,7 +130,7 @@ class ProvidedDependencyTemplate extends ModuleDependency.Template {
107
130
  chunkGraph,
108
131
  request: dep.request,
109
132
  runtimeRequirements
110
- })}${pathToString(dep.path)};\n`,
133
+ })}${pathToString(/** @type {string[]} */ (usedName))};\n`,
111
134
  InitFragment.STAGE_PROVIDES,
112
135
  1,
113
136
  `provided ${dep.identifier}`
package/lib/index.js CHANGED
@@ -342,6 +342,9 @@ module.exports = mergeExports(fn, {
342
342
  get ModuleDependency() {
343
343
  return require("./dependencies/ModuleDependency");
344
344
  },
345
+ get HarmonyImportDependency() {
346
+ return require("./dependencies/HarmonyImportDependency");
347
+ },
345
348
  get ConstDependency() {
346
349
  return require("./dependencies/ConstDependency");
347
350
  },
@@ -1447,6 +1447,11 @@ class JavascriptParser extends Parser {
1447
1447
  this.walkExpression(classElement.value);
1448
1448
  this.scope.topLevelScope = wasTopLevel;
1449
1449
  }
1450
+ } else if (classElement.type === "StaticBlock") {
1451
+ const wasTopLevel = this.scope.topLevelScope;
1452
+ this.scope.topLevelScope = false;
1453
+ this.walkBlockStatement(classElement);
1454
+ this.scope.topLevelScope = wasTopLevel;
1450
1455
  }
1451
1456
  }
1452
1457
  }
@@ -1903,7 +1908,7 @@ class JavascriptParser extends Parser {
1903
1908
  !this.hooks.importSpecifier.call(
1904
1909
  statement,
1905
1910
  source,
1906
- specifier.imported.name,
1911
+ specifier.imported.name || specifier.imported.value,
1907
1912
  name
1908
1913
  )
1909
1914
  ) {
@@ -1973,7 +1978,7 @@ class JavascriptParser extends Parser {
1973
1978
  const specifier = statement.specifiers[specifierIndex];
1974
1979
  switch (specifier.type) {
1975
1980
  case "ExportSpecifier": {
1976
- const name = specifier.exported.name;
1981
+ const name = specifier.exported.name || specifier.exported.value;
1977
1982
  if (source) {
1978
1983
  this.hooks.exportImportSpecifier.call(
1979
1984
  statement,
@@ -21,7 +21,7 @@ const HarmonyImportDependency = require("../dependencies/HarmonyImportDependency
21
21
  const JavascriptParser = require("../javascript/JavascriptParser");
22
22
  const { equals } = require("../util/ArrayHelpers");
23
23
  const LazySet = require("../util/LazySet");
24
- const { concatComparators, keepOriginalOrder } = require("../util/comparators");
24
+ const { concatComparators } = require("../util/comparators");
25
25
  const createHash = require("../util/createHash");
26
26
  const { makePathsRelative } = require("../util/identifier");
27
27
  const makeSerializable = require("../util/makeSerializable");
@@ -185,23 +185,25 @@ const RESERVED_NAMES = new Set(
185
185
  .split(",")
186
186
  );
187
187
 
188
- const bySourceOrder = (a, b) => {
189
- const aOrder = a.sourceOrder;
190
- const bOrder = b.sourceOrder;
191
- if (isNaN(aOrder)) {
192
- if (!isNaN(bOrder)) {
188
+ const createComparator = (property, comparator) => (a, b) =>
189
+ comparator(a[property], b[property]);
190
+ const compareNumbers = (a, b) => {
191
+ if (isNaN(a)) {
192
+ if (!isNaN(b)) {
193
193
  return 1;
194
194
  }
195
195
  } else {
196
- if (isNaN(bOrder)) {
196
+ if (isNaN(b)) {
197
197
  return -1;
198
198
  }
199
- if (aOrder !== bOrder) {
200
- return aOrder < bOrder ? -1 : 1;
199
+ if (a !== b) {
200
+ return a < b ? -1 : 1;
201
201
  }
202
202
  }
203
203
  return 0;
204
204
  };
205
+ const bySourceOrder = createComparator("sourceOrder", compareNumbers);
206
+ const byRangeStart = createComparator("rangeStart", compareNumbers);
205
207
 
206
208
  const joinIterableWithComma = iterable => {
207
209
  // This is more performant than Array.from().join(", ")
@@ -885,6 +887,9 @@ class ConcatenatedModule extends Module {
885
887
  for (const c of moduleGraph.getOutgoingConnections(this))
886
888
  connections.push(c);
887
889
  }
890
+ /**
891
+ * @type {Array<{ connection: ModuleGraphConnection, sourceOrder: number, rangeStart: number }>}
892
+ */
888
893
  const references = connections
889
894
  .filter(connection => {
890
895
  if (!(connection.dependency instanceof HarmonyImportDependency))
@@ -896,15 +901,33 @@ class ConcatenatedModule extends Module {
896
901
  connection.isTargetActive(runtime)
897
902
  );
898
903
  })
899
- .map(connection => ({
900
- connection,
901
- sourceOrder: /** @type {HarmonyImportDependency} */ (
904
+ .map(connection => {
905
+ const dep = /** @type {HarmonyImportDependency} */ (
902
906
  connection.dependency
903
- ).sourceOrder
904
- }));
905
- references.sort(
906
- concatComparators(bySourceOrder, keepOriginalOrder(references))
907
- );
907
+ );
908
+ return {
909
+ connection,
910
+ sourceOrder: dep.sourceOrder,
911
+ rangeStart: dep.range && dep.range[0]
912
+ };
913
+ });
914
+ /**
915
+ * bySourceOrder
916
+ * @example
917
+ * import a from "a"; // sourceOrder=1
918
+ * import b from "b"; // sourceOrder=2
919
+ *
920
+ * byRangeStart
921
+ * @example
922
+ * import {a, b} from "a"; // sourceOrder=1
923
+ * a.a(); // first range
924
+ * b.b(); // second range
925
+ *
926
+ * If there is no reexport, we have the same source.
927
+ * If there is reexport, but module has side effects, this will lead to reexport module only.
928
+ * If there is side-effects-free reexport, we can get simple deterministic result with range start comparison.
929
+ */
930
+ references.sort(concatComparators(bySourceOrder, byRangeStart));
908
931
  /** @type {Map<Module, { connection: ModuleGraphConnection, runtimeCondition: RuntimeSpec | true }>} */
909
932
  const referencesMap = new Map();
910
933
  for (const { connection } of references) {
@@ -74,7 +74,6 @@ class AsyncModuleRuntimeModule extends HelperRuntimeModule {
74
74
  `${fn} = ${runtimeTemplate.basicFunction("module, body, hasAwait", [
75
75
  "var queue;",
76
76
  "hasAwait && ((queue = []).d = 1);",
77
- "if(queue) queue.moduleId = module.id;",
78
77
  "var depQueues = new Set();",
79
78
  "var exports = module.exports;",
80
79
  "var currentDeps;",
@@ -89,7 +88,6 @@ class AsyncModuleRuntimeModule extends HelperRuntimeModule {
89
88
  `queue && fn(queue), depQueues.forEach(fn), promise["catch"](${runtimeTemplate.emptyFunction()})`,
90
89
  "fn"
91
90
  )};`,
92
- "promise.moduleId = module.id;",
93
91
  "module.exports = promise;",
94
92
  `body(${runtimeTemplate.basicFunction("deps", [
95
93
  "currentDeps = wrapDeps(deps);",
@@ -87,13 +87,15 @@ class LoadScriptRuntimeModule extends HelperRuntimeModule {
87
87
  : "url"
88
88
  };`,
89
89
  crossOriginLoading
90
- ? Template.asString([
91
- "if (script.src.indexOf(window.location.origin + '/') !== 0) {",
92
- Template.indent(
93
- `script.crossOrigin = ${JSON.stringify(crossOriginLoading)};`
94
- ),
95
- "}"
96
- ])
90
+ ? crossOriginLoading === "use-credentials"
91
+ ? 'script.crossOrigin = "use-credentials";'
92
+ : Template.asString([
93
+ "if (script.src.indexOf(window.location.origin + '/') !== 0) {",
94
+ Template.indent(
95
+ `script.crossOrigin = ${JSON.stringify(crossOriginLoading)};`
96
+ ),
97
+ "}"
98
+ ])
97
99
  : ""
98
100
  ]);
99
101
 
@@ -263,15 +263,17 @@ class JsonpChunkLoadingRuntimeModule extends RuntimeModule {
263
263
  'link.as = "script";',
264
264
  `link.href = ${RuntimeGlobals.publicPath} + ${RuntimeGlobals.getChunkScriptFilename}(chunkId);`,
265
265
  crossOriginLoading
266
- ? Template.asString([
267
- "if (link.href.indexOf(window.location.origin + '/') !== 0) {",
268
- Template.indent(
269
- `link.crossOrigin = ${JSON.stringify(
270
- crossOriginLoading
271
- )};`
272
- ),
273
- "}"
274
- ])
266
+ ? crossOriginLoading === "use-credentials"
267
+ ? 'link.crossOrigin = "use-credentials";'
268
+ : Template.asString([
269
+ "if (link.href.indexOf(window.location.origin + '/') !== 0) {",
270
+ Template.indent(
271
+ `link.crossOrigin = ${JSON.stringify(
272
+ crossOriginLoading
273
+ )};`
274
+ ),
275
+ "}"
276
+ ])
275
277
  : ""
276
278
  ]),
277
279
  chunk
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webpack",
3
- "version": "5.73.0",
3
+ "version": "5.74.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",
@@ -10,11 +10,11 @@
10
10
  "@webassemblyjs/ast": "1.11.1",
11
11
  "@webassemblyjs/wasm-edit": "1.11.1",
12
12
  "@webassemblyjs/wasm-parser": "1.11.1",
13
- "acorn": "^8.4.1",
13
+ "acorn": "^8.7.1",
14
14
  "acorn-import-assertions": "^1.7.6",
15
15
  "browserslist": "^4.14.5",
16
16
  "chrome-trace-event": "^1.0.2",
17
- "enhanced-resolve": "^5.9.3",
17
+ "enhanced-resolve": "^5.10.0",
18
18
  "es-module-lexer": "^0.9.0",
19
19
  "eslint-scope": "5.1.1",
20
20
  "events": "^3.2.0",
@@ -27,7 +27,7 @@
27
27
  "schema-utils": "^3.1.0",
28
28
  "tapable": "^2.1.1",
29
29
  "terser-webpack-plugin": "^5.1.3",
30
- "watchpack": "^2.3.1",
30
+ "watchpack": "^2.4.0",
31
31
  "webpack-sources": "^3.2.3"
32
32
  },
33
33
  "peerDependenciesMeta": {
@@ -121,6 +121,7 @@
121
121
  "url": "https://opencollective.com/webpack"
122
122
  },
123
123
  "homepage": "https://github.com/webpack/webpack",
124
+ "bugs": "https://github.com/webpack/webpack/issues",
124
125
  "main": "lib/index.js",
125
126
  "bin": {
126
127
  "webpack": "bin/webpack.js"