webpack 5.26.3 → 5.28.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/bin/webpack.js CHANGED
File without changes
@@ -457,7 +457,7 @@ module.exports = class MultiCompiler {
457
457
  node.compiler,
458
458
  i,
459
459
  nodeDone.bind(null, node),
460
- () => node.state !== "running",
460
+ () => node.state !== "done" && node.state !== "running",
461
461
  () => nodeChange(node),
462
462
  () => nodeInvalid(node)
463
463
  )
@@ -37,7 +37,7 @@ const {
37
37
  } = require("./util/comparators");
38
38
  const createHash = require("./util/createHash");
39
39
  const { join } = require("./util/fs");
40
- const { contextify } = require("./util/identifier");
40
+ const { contextify, absolutify } = require("./util/identifier");
41
41
  const makeSerializable = require("./util/makeSerializable");
42
42
  const memoize = require("./util/memoize");
43
43
 
@@ -367,6 +367,7 @@ class NormalModule extends Module {
367
367
  * @param {NormalModuleFactory} normalModuleFactory the normal module factory handling the unsafe caching
368
368
  */
369
369
  _restoreFromUnsafeCache(unsafeCacheData, normalModuleFactory) {
370
+ super._restoreFromUnsafeCache(unsafeCacheData, normalModuleFactory);
370
371
  this.parserOptions = unsafeCacheData.parserOptions;
371
372
  this.parser = normalModuleFactory.getParser(this.type, this.parserOptions);
372
373
  this.generatorOptions = unsafeCacheData.generatorOptions;
@@ -441,6 +442,30 @@ class NormalModule extends Module {
441
442
  }
442
443
  };
443
444
  };
445
+ const getAbsolutify = memoize(() =>
446
+ absolutify.bindCache(compilation.compiler.root)
447
+ );
448
+ const getAbsolutifyInContext = memoize(() =>
449
+ absolutify.bindContextCache(this.context, compilation.compiler.root)
450
+ );
451
+ const getContextify = memoize(() =>
452
+ contextify.bindCache(compilation.compiler.root)
453
+ );
454
+ const getContextifyInContext = memoize(() =>
455
+ contextify.bindContextCache(this.context, compilation.compiler.root)
456
+ );
457
+ const utils = {
458
+ absolutify: (context, request) => {
459
+ return context === this.context
460
+ ? getAbsolutifyInContext()(request)
461
+ : getAbsolutify()(context, request);
462
+ },
463
+ contextify: (context, request) => {
464
+ return context === this.context
465
+ ? getContextifyInContext()(request)
466
+ : getContextify()(context, request);
467
+ }
468
+ };
444
469
  const loaderContext = {
445
470
  version: 2,
446
471
  getOptions: schema => {
@@ -553,6 +578,7 @@ class NormalModule extends Module {
553
578
  }
554
579
  this.buildInfo.buildDependencies.add(dep);
555
580
  },
581
+ utils,
556
582
  rootContext: options.context,
557
583
  webpack: true,
558
584
  sourceMap: !!this.useSourceMap,
@@ -693,7 +719,12 @@ class NormalModule extends Module {
693
719
 
694
720
  const hooks = NormalModule.getCompilationHooks(compilation);
695
721
 
696
- hooks.beforeLoaders.call(this.loaders, this, loaderContext);
722
+ try {
723
+ hooks.beforeLoaders.call(this.loaders, this, loaderContext);
724
+ } catch (err) {
725
+ processResult(err);
726
+ return;
727
+ }
697
728
  runLoaders(
698
729
  {
699
730
  resource: this.resource,
@@ -597,7 +597,7 @@ class NormalModuleFactory extends ModuleFactory {
597
597
  }
598
598
 
599
599
  // resource without scheme and without path
600
- else if (/^($|\?|#)/.test(unresolvedResource)) {
600
+ else if (/^($|\?)/.test(unresolvedResource)) {
601
601
  resourceData = {
602
602
  resource: unresolvedResource,
603
603
  data: {},
@@ -213,6 +213,7 @@ class RecordIdsPlugin {
213
213
  }
214
214
  if (records.chunks.bySource) {
215
215
  for (const chunk of chunks) {
216
+ if (chunk.id !== null) continue;
216
217
  const sources = getChunkSources(chunk);
217
218
  for (const source of sources) {
218
219
  const id = records.chunks.bySource[source];
@@ -15,6 +15,7 @@ const { makePathsRelative } = require("../util/identifier");
15
15
 
16
16
  /** @typedef {import("webpack-sources").Source} Source */
17
17
  /** @typedef {import("../../declarations/WebpackOptions").AssetGeneratorOptions} AssetGeneratorOptions */
18
+ /** @typedef {import("../../declarations/WebpackOptions").RawPublicPath} RawPublicPath */
18
19
  /** @typedef {import("../Compilation")} Compilation */
19
20
  /** @typedef {import("../Compiler")} Compiler */
20
21
  /** @typedef {import("../Generator").GenerateContext} GenerateContext */
@@ -24,6 +25,55 @@ const { makePathsRelative } = require("../util/identifier");
24
25
  /** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */
25
26
  /** @typedef {import("../util/Hash")} Hash */
26
27
 
28
+ const mergeMaybeArrays = (a, b) => {
29
+ const set = new Set();
30
+ if (Array.isArray(a)) for (const item of a) set.add(item);
31
+ else set.add(a);
32
+ if (Array.isArray(b)) for (const item of b) set.add(item);
33
+ else set.add(b);
34
+ return Array.from(set);
35
+ };
36
+
37
+ const mergeAssetInfo = (a, b) => {
38
+ const result = { ...a, ...b };
39
+ for (const key of Object.keys(a)) {
40
+ if (key in b) {
41
+ if (a[key] === b[key]) continue;
42
+ switch (key) {
43
+ case "fullhash":
44
+ case "chunkhash":
45
+ case "modulehash":
46
+ case "contenthash":
47
+ result[key] = mergeMaybeArrays(a[key], b[key]);
48
+ break;
49
+ case "immutable":
50
+ case "development":
51
+ case "hotModuleReplacement":
52
+ case "javascriptModule ":
53
+ result[key] = a[key] || b[key];
54
+ break;
55
+ case "related":
56
+ result[key] = mergeRelatedInfo(a[key], b[key]);
57
+ break;
58
+ default:
59
+ throw new Error(`Can't handle conflicting asset info for ${key}`);
60
+ }
61
+ }
62
+ }
63
+ return result;
64
+ };
65
+
66
+ const mergeRelatedInfo = (a, b) => {
67
+ const result = { ...a, ...b };
68
+ for (const key of Object.keys(a)) {
69
+ if (key in b) {
70
+ if (a[key] === b[key]) continue;
71
+ result[key] = mergeMaybeArrays(a[key], b[key]);
72
+ }
73
+ }
74
+ return result;
75
+ };
76
+
27
77
  const JS_TYPES = new Set(["javascript"]);
28
78
  const JS_AND_ASSET_TYPES = new Set(["javascript", "asset"]);
29
79
 
@@ -31,12 +81,14 @@ class AssetGenerator extends Generator {
31
81
  /**
32
82
  * @param {AssetGeneratorOptions["dataUrl"]=} dataUrlOptions the options for the data url
33
83
  * @param {string=} filename override for output.assetModuleFilename
84
+ * @param {RawPublicPath=} publicPath override for output.assetModulePublicPath
34
85
  * @param {boolean=} emit generate output asset
35
86
  */
36
- constructor(dataUrlOptions, filename, emit) {
87
+ constructor(dataUrlOptions, filename, publicPath, emit) {
37
88
  super();
38
89
  this.dataUrlOptions = dataUrlOptions;
39
90
  this.filename = filename;
91
+ this.publicPath = publicPath;
40
92
  this.emit = emit;
41
93
  }
42
94
 
@@ -131,9 +183,9 @@ class AssetGenerator extends Generator {
131
183
  module.matchResource || module.resource,
132
184
  runtimeTemplate.compilation.compiler.root
133
185
  ).replace(/^\.\//, "");
134
- const {
186
+ let {
135
187
  path: filename,
136
- info
188
+ info: assetInfo
137
189
  } = runtimeTemplate.compilation.getAssetPathWithInfo(
138
190
  assetModuleFilename,
139
191
  {
@@ -144,11 +196,33 @@ class AssetGenerator extends Generator {
144
196
  contentHash
145
197
  }
146
198
  );
147
- module.buildInfo.filename = filename;
148
- module.buildInfo.assetInfo = {
199
+ let publicPath;
200
+ if (this.publicPath) {
201
+ const {
202
+ path,
203
+ info
204
+ } = runtimeTemplate.compilation.getAssetPathWithInfo(
205
+ this.publicPath,
206
+ {
207
+ module,
208
+ runtime,
209
+ filename: sourceFilename,
210
+ chunkGraph,
211
+ contentHash
212
+ }
213
+ );
214
+ publicPath = JSON.stringify(path);
215
+ assetInfo = mergeAssetInfo(assetInfo, info);
216
+ } else {
217
+ publicPath = RuntimeGlobals.publicPath;
218
+ runtimeRequirements.add(RuntimeGlobals.publicPath); // add __webpack_require__.p
219
+ }
220
+ assetInfo = {
149
221
  sourceFilename,
150
- ...info
222
+ ...assetInfo
151
223
  };
224
+ module.buildInfo.filename = filename;
225
+ module.buildInfo.assetInfo = assetInfo;
152
226
  if (getData) {
153
227
  // Due to code generation caching module.buildInfo.XXX can't used to store such information
154
228
  // It need to be stored in the code generation results instead, where it's cached too
@@ -156,15 +230,13 @@ class AssetGenerator extends Generator {
156
230
  const data = getData();
157
231
  data.set("fullContentHash", fullHash);
158
232
  data.set("filename", filename);
159
- data.set("assetInfo", info);
233
+ data.set("assetInfo", assetInfo);
160
234
  }
161
235
 
162
- runtimeRequirements.add(RuntimeGlobals.publicPath); // add __webpack_require__.p
163
-
164
236
  return new RawSource(
165
- `${RuntimeGlobals.module}.exports = ${
166
- RuntimeGlobals.publicPath
167
- } + ${JSON.stringify(filename)};`
237
+ `${
238
+ RuntimeGlobals.module
239
+ }.exports = ${publicPath} + ${JSON.stringify(filename)};`
168
240
  );
169
241
  }
170
242
  }
@@ -118,8 +118,10 @@ class AssetModulesPlugin {
118
118
  }
119
119
 
120
120
  let filename = undefined;
121
+ let publicPath = undefined;
121
122
  if (type !== "asset/inline") {
122
123
  filename = generatorOptions.filename;
124
+ publicPath = generatorOptions.publicPath;
123
125
  }
124
126
 
125
127
  const AssetGenerator = getAssetGenerator();
@@ -127,6 +129,7 @@ class AssetModulesPlugin {
127
129
  return new AssetGenerator(
128
130
  dataUrl,
129
131
  filename,
132
+ publicPath,
130
133
  generatorOptions.emit !== false
131
134
  );
132
135
  });
@@ -77,9 +77,9 @@ WorkerDependency.Template = class WorkerDependencyTemplate extends (
77
77
  source.replace(
78
78
  dep.range[0],
79
79
  dep.range[1] - 1,
80
- `new URL(/* worker import */ ${RuntimeGlobals.publicPath} + ${
80
+ `/* worker import */ ${RuntimeGlobals.publicPath} + ${
81
81
  RuntimeGlobals.getChunkScriptFilename
82
- }(${JSON.stringify(chunk.id)}), ${RuntimeGlobals.baseURI})`
82
+ }(${JSON.stringify(chunk.id)}), ${RuntimeGlobals.baseURI}`
83
83
  );
84
84
  }
85
85
  };
@@ -294,7 +294,7 @@ class WorkerPlugin {
294
294
  }
295
295
  } else if (hasSpreadInOptions && insertType === "comma") {
296
296
  const dep = new ConstDependency(
297
- ",type: undefined",
297
+ ", type: undefined",
298
298
  insertLocation
299
299
  );
300
300
  dep.loc = expr.loc;
@@ -32,6 +32,13 @@ const { registerNotSerializable } = require("../util/serialization");
32
32
  /** @typedef {import("../util/Hash")} Hash */
33
33
  /** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */
34
34
 
35
+ const IGNORED_DEPENDENCY_TYPES = new Set([
36
+ "import.meta.webpackHot.accept",
37
+ "import.meta.webpackHot.decline",
38
+ "module.hot.accept",
39
+ "module.hot.decline"
40
+ ]);
41
+
35
42
  /**
36
43
  * @param {undefined|string|RegExp|Function} test test option
37
44
  * @param {Module} module the module
@@ -56,9 +63,9 @@ const checkTest = (test, module) => {
56
63
  const TYPES = new Set(["javascript"]);
57
64
 
58
65
  class LazyCompilationDependency extends Dependency {
59
- constructor(originalModule) {
66
+ constructor(proxyModule) {
60
67
  super();
61
- this.originalModule = originalModule;
68
+ this.proxyModule = proxyModule;
62
69
  }
63
70
 
64
71
  get category() {
@@ -73,7 +80,7 @@ class LazyCompilationDependency extends Dependency {
73
80
  * @returns {string | null} an identifier to merge equal requests
74
81
  */
75
82
  getResourceIdentifier() {
76
- return this.originalModule.identifier();
83
+ return this.proxyModule.originalModule.identifier();
77
84
  }
78
85
  }
79
86
 
@@ -116,6 +123,10 @@ class LazyCompilationProxyModule extends Module {
116
123
  updateCacheModule(module) {
117
124
  super.updateCacheModule(module);
118
125
  const m = /** @type {LazyCompilationProxyModule} */ (module);
126
+ this.originalModule = m.originalModule;
127
+ this.request = m.request;
128
+ this.client = m.client;
129
+ this.data = m.data;
119
130
  this.active = m.active;
120
131
  }
121
132
 
@@ -154,7 +165,7 @@ class LazyCompilationProxyModule extends Module {
154
165
  const dep = new CommonJsRequireDependency(this.client);
155
166
  this.addDependency(dep);
156
167
  if (this.active) {
157
- const dep = new LazyCompilationDependency(this.originalModule);
168
+ const dep = new LazyCompilationDependency(this);
158
169
  const block = new AsyncDependenciesBlock({});
159
170
  block.addDependency(dep);
160
171
  this.addBlock(block);
@@ -282,7 +293,7 @@ class LazyCompilationDependencyFactory extends ModuleFactory {
282
293
  const dependency = /** @type {LazyCompilationDependency} */ (data
283
294
  .dependencies[0]);
284
295
  callback(null, {
285
- module: dependency.originalModule
296
+ module: dependency.proxyModule.originalModule
286
297
  });
287
298
  }
288
299
  }
@@ -336,6 +347,7 @@ class LazyCompilationPlugin {
336
347
  if (
337
348
  resolveData.dependencies.every(
338
349
  dep =>
350
+ IGNORED_DEPENDENCY_TYPES.has(dep.type) ||
339
351
  (this.imports && dep.type === "import()") ||
340
352
  (this.entries && dep.type === "entry")
341
353
  ) &&
@@ -10,7 +10,10 @@ const { RuntimeGlobals } = require("..");
10
10
  const HotUpdateChunk = require("../HotUpdateChunk");
11
11
  const Template = require("../Template");
12
12
  const { getCompilationHooks } = require("./JavascriptModulesPlugin");
13
- const { generateEntryStartup } = require("./StartupHelpers");
13
+ const {
14
+ generateEntryStartup,
15
+ updateHashForEntryStartup
16
+ } = require("./StartupHelpers");
14
17
 
15
18
  /** @typedef {import("../Compiler")} Compiler */
16
19
 
@@ -140,6 +143,10 @@ class ArrayPushCallbackChunkFormatPlugin {
140
143
  hash.update(`${runtimeTemplate.outputOptions.chunkLoadingGlobal}`);
141
144
  hash.update(`${runtimeTemplate.outputOptions.hotUpdateGlobal}`);
142
145
  hash.update(`${runtimeTemplate.outputOptions.globalObject}`);
146
+ const entries = Array.from(
147
+ chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk)
148
+ );
149
+ updateHashForEntryStartup(hash, chunkGraph, entries, chunk);
143
150
  }
144
151
  );
145
152
  }
@@ -12,7 +12,10 @@ const {
12
12
  getChunkFilenameTemplate,
13
13
  getCompilationHooks
14
14
  } = require("./JavascriptModulesPlugin");
15
- const { generateEntryStartup } = require("./StartupHelpers");
15
+ const {
16
+ generateEntryStartup,
17
+ updateHashForEntryStartup
18
+ } = require("./StartupHelpers");
16
19
 
17
20
  /** @typedef {import("../Compiler")} Compiler */
18
21
 
@@ -156,6 +159,10 @@ class CommonJsChunkFormatPlugin {
156
159
  if (chunk.hasRuntime()) return;
157
160
  hash.update("CommonJsChunkFormatPlugin");
158
161
  hash.update("1");
162
+ const entries = Array.from(
163
+ chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk)
164
+ );
165
+ updateHashForEntryStartup(hash, chunkGraph, entries, chunk);
159
166
  }
160
167
  );
161
168
  }
@@ -11,6 +11,7 @@ const Template = require("../Template");
11
11
  const { isSubset } = require("../util/SetHelpers");
12
12
  const { chunkHasJs } = require("./JavascriptModulesPlugin");
13
13
 
14
+ /** @typedef {import("../util/Hash")} Hash */
14
15
  /** @typedef {import("../Chunk")} Chunk */
15
16
  /** @typedef {import("../Compilation")} Compilation */
16
17
  /** @typedef {import("../ChunkGraph")} ChunkGraph */
@@ -71,21 +72,24 @@ exports.generateEntryStartup = (
71
72
  return `__webpack_exec__(${JSON.stringify(id)})`;
72
73
  };
73
74
  const outputCombination = (chunks, moduleIds, final) => {
74
- const old = final ? "undefined" : "0";
75
- const prefix = final ? EXPORT_PREFIX : "";
76
75
  if (chunks.size === 0) {
77
- runtime.push(`${prefix}(${moduleIds.map(runModule).join(", ")});`);
76
+ runtime.push(
77
+ `${final ? EXPORT_PREFIX : ""}(${moduleIds.map(runModule).join(", ")});`
78
+ );
78
79
  } else {
79
80
  const fn = runtimeTemplate.returningFunction(
80
81
  moduleIds.map(runModule).join(", ")
81
82
  );
82
83
  runtime.push(
83
- `${prefix}${
84
+ `${final && !passive ? EXPORT_PREFIX : ""}${
84
85
  passive
85
86
  ? RuntimeGlobals.onChunksLoaded
86
87
  : RuntimeGlobals.startupEntrypoint
87
- }(${old}, ${JSON.stringify(Array.from(chunks, c => c.id))}, ${fn});`
88
+ }(0, ${JSON.stringify(Array.from(chunks, c => c.id))}, ${fn});`
88
89
  );
90
+ if (final && passive) {
91
+ runtime.push(`${EXPORT_PREFIX}${RuntimeGlobals.onChunksLoaded}();`);
92
+ }
89
93
  }
90
94
  };
91
95
 
@@ -119,6 +123,23 @@ exports.generateEntryStartup = (
119
123
  return Template.asString(runtime);
120
124
  };
121
125
 
126
+ /**
127
+ * @param {Hash} hash the hash to update
128
+ * @param {ChunkGraph} chunkGraph chunkGraph
129
+ * @param {import("../ChunkGraph").EntryModuleWithChunkGroup[]} entries entries
130
+ * @param {Chunk} chunk chunk
131
+ * @returns {void}
132
+ */
133
+ exports.updateHashForEntryStartup = (hash, chunkGraph, entries, chunk) => {
134
+ for (const [module, entrypoint] of entries) {
135
+ const runtimeChunk = entrypoint.getRuntimeChunk();
136
+ const moduleId = chunkGraph.getModuleId(module);
137
+ hash.update(`${moduleId}`);
138
+ for (const c of getAllChunks(entrypoint, chunk, runtimeChunk))
139
+ hash.update(`${c.id}`);
140
+ }
141
+ };
142
+
122
143
  /**
123
144
  * @param {Chunk} chunk the chunk
124
145
  * @param {ChunkGraph} chunkGraph the chunk graph
@@ -408,16 +408,13 @@ class ObjectMiddleware extends SerializerMiddleware {
408
408
  };
409
409
  this.extendContext(ctx);
410
410
  const process = item => {
411
- // check if we can emit a reference
412
- const ref = referenceable.get(item);
413
-
414
- if (ref !== undefined) {
415
- result.push(ESCAPE, ref - currentPos);
416
-
417
- return;
418
- }
419
-
420
411
  if (Buffer.isBuffer(item)) {
412
+ // check if we can emit a reference
413
+ const ref = referenceable.get(item);
414
+ if (ref !== undefined) {
415
+ result.push(ESCAPE, ref - currentPos);
416
+ return;
417
+ }
421
418
  const alreadyUsedBuffer = dedupeBuffer(item);
422
419
  if (alreadyUsedBuffer !== item) {
423
420
  const ref = referenceable.get(alreadyUsedBuffer);
@@ -431,7 +428,19 @@ class ObjectMiddleware extends SerializerMiddleware {
431
428
  addReferenceable(item);
432
429
 
433
430
  result.push(item);
434
- } else if (typeof item === "object" && item !== null) {
431
+ } else if (item === ESCAPE) {
432
+ result.push(ESCAPE, ESCAPE_ESCAPE_VALUE);
433
+ } else if (
434
+ typeof item === "object"
435
+ // We don't have to check for null as ESCAPE is null and this has been checked before
436
+ ) {
437
+ // check if we can emit a reference
438
+ const ref = referenceable.get(item);
439
+ if (ref !== undefined) {
440
+ result.push(ESCAPE, ref - currentPos);
441
+ return;
442
+ }
443
+
435
444
  if (cycleStack.has(item)) {
436
445
  throw new Error(`Circular references can't be serialized`);
437
446
  }
@@ -464,6 +473,12 @@ class ObjectMiddleware extends SerializerMiddleware {
464
473
  } else if (typeof item === "string") {
465
474
  if (item.length > 1) {
466
475
  // short strings are shorter when not emitting a reference (this saves 1 byte per empty string)
476
+ // check if we can emit a reference
477
+ const ref = referenceable.get(item);
478
+ if (ref !== undefined) {
479
+ result.push(ESCAPE, ref - currentPos);
480
+ return;
481
+ }
467
482
  addReferenceable(item);
468
483
  }
469
484
 
@@ -476,8 +491,6 @@ class ObjectMiddleware extends SerializerMiddleware {
476
491
  }
477
492
 
478
493
  result.push(item);
479
- } else if (item === ESCAPE) {
480
- result.push(ESCAPE, ESCAPE_ESCAPE_VALUE);
481
494
  } else if (typeof item === "function") {
482
495
  if (!SerializerMiddleware.isLazy(item))
483
496
  throw new Error("Unexpected function " + item);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webpack",
3
- "version": "5.26.3",
3
+ "version": "5.28.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",
@@ -107,6 +107,9 @@
107
107
  },
108
108
  "filename": {
109
109
  "$ref": "#/definitions/FilenameTemplate"
110
+ },
111
+ "publicPath": {
112
+ "$ref": "#/definitions/RawPublicPath"
110
113
  }
111
114
  }
112
115
  },
@@ -178,6 +181,9 @@
178
181
  },
179
182
  "filename": {
180
183
  "$ref": "#/definitions/FilenameTemplate"
184
+ },
185
+ "publicPath": {
186
+ "$ref": "#/definitions/RawPublicPath"
181
187
  }
182
188
  }
183
189
  },
@@ -2912,11 +2918,19 @@
2912
2918
  "type": "boolean"
2913
2919
  },
2914
2920
  "PublicPath": {
2915
- "description": "The `publicPath` specifies the public URL address of the output files when referenced in a browser.",
2921
+ "description": "The 'publicPath' specifies the public URL address of the output files when referenced in a browser.",
2916
2922
  "anyOf": [
2917
2923
  {
2918
2924
  "enum": ["auto"]
2919
2925
  },
2926
+ {
2927
+ "$ref": "#/definitions/RawPublicPath"
2928
+ }
2929
+ ]
2930
+ },
2931
+ "RawPublicPath": {
2932
+ "description": "The 'publicPath' specifies the public URL address of the output files when referenced in a browser.",
2933
+ "anyOf": [
2920
2934
  {
2921
2935
  "type": "string"
2922
2936
  },
package/types.d.ts CHANGED
@@ -312,6 +312,11 @@ declare interface AssetResourceGeneratorOptions {
312
312
  * Specifies the filename template of output files on disk. You must **not** specify an absolute path here, but the path may contain folders separated by '/'! The specified path is joined with the value of the 'output.path' option to determine the location on disk.
313
313
  */
314
314
  filename?: string | ((pathData: PathData, assetInfo?: AssetInfo) => string);
315
+
316
+ /**
317
+ * The 'publicPath' specifies the public URL address of the output files when referenced in a browser.
318
+ */
319
+ publicPath?: string | ((pathData: PathData, assetInfo?: AssetInfo) => string);
315
320
  }
316
321
  declare abstract class AsyncDependenciesBlock extends DependenciesBlock {
317
322
  groupOptions: RawChunkGroupOptions & { name?: string } & {
@@ -7388,7 +7393,7 @@ declare interface Output {
7388
7393
  pathinfo?: boolean | "verbose";
7389
7394
 
7390
7395
  /**
7391
- * The `publicPath` specifies the public URL address of the output files when referenced in a browser.
7396
+ * The 'publicPath' specifies the public URL address of the output files when referenced in a browser.
7392
7397
  */
7393
7398
  publicPath?: string | ((pathData: PathData, assetInfo?: AssetInfo) => string);
7394
7399
 
@@ -7650,7 +7655,7 @@ declare interface OutputNormalized {
7650
7655
  pathinfo?: boolean | "verbose";
7651
7656
 
7652
7657
  /**
7653
- * The `publicPath` specifies the public URL address of the output files when referenced in a browser.
7658
+ * The 'publicPath' specifies the public URL address of the output files when referenced in a browser.
7654
7659
  */
7655
7660
  publicPath?: string | ((pathData: PathData, assetInfo?: AssetInfo) => string);
7656
7661