webpack 5.90.3 → 5.91.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 +5 -5
- package/bin/webpack.js +5 -1
- package/lib/APIPlugin.js +8 -4
- package/lib/AutomaticPrefetchPlugin.js +1 -1
- package/lib/BannerPlugin.js +3 -1
- package/lib/Cache.js +7 -1
- package/lib/CacheFacade.js +3 -3
- package/lib/ChunkGraph.js +32 -18
- package/lib/ChunkGroup.js +14 -14
- package/lib/CleanPlugin.js +7 -5
- package/lib/Compilation.js +262 -93
- package/lib/Compiler.js +199 -83
- package/lib/ConditionalInitFragment.js +4 -5
- package/lib/ContextModule.js +2 -0
- package/lib/ContextModuleFactory.js +4 -2
- package/lib/ContextReplacementPlugin.js +3 -2
- package/lib/DefinePlugin.js +4 -2
- package/lib/Dependency.js +4 -2
- package/lib/DependencyTemplate.js +7 -2
- package/lib/DllModule.js +1 -0
- package/lib/DllReferencePlugin.js +6 -2
- package/lib/EntryOptionPlugin.js +4 -1
- package/lib/EntryPlugin.js +6 -1
- package/lib/Entrypoint.js +1 -1
- package/lib/ExportsInfo.js +1 -4
- package/lib/ExternalModule.js +118 -24
- package/lib/ExternalModuleFactoryPlugin.js +37 -2
- package/lib/FileSystemInfo.js +1 -1
- package/lib/Generator.js +2 -1
- package/lib/HookWebpackError.js +2 -2
- package/lib/InitFragment.js +5 -3
- package/lib/LibManifestPlugin.js +15 -7
- package/lib/Module.js +30 -2
- package/lib/ModuleFilenameHelpers.js +1 -1
- package/lib/ModuleGraph.js +56 -27
- package/lib/ModuleGraphConnection.js +2 -1
- package/lib/MultiCompiler.js +26 -8
- package/lib/NodeStuffPlugin.js +14 -3
- package/lib/NormalModule.js +3 -1
- package/lib/NormalModuleFactory.js +1 -1
- package/lib/NormalModuleReplacementPlugin.js +5 -1
- package/lib/ProvidePlugin.js +3 -1
- package/lib/RawModule.js +2 -1
- package/lib/ResolverFactory.js +3 -1
- package/lib/RuntimeModule.js +4 -4
- package/lib/RuntimePlugin.js +1 -0
- package/lib/RuntimeTemplate.js +102 -34
- package/lib/SourceMapDevToolPlugin.js +4 -1
- package/lib/Stats.js +10 -3
- package/lib/TemplatedPathPlugin.js +32 -6
- package/lib/Watching.js +67 -60
- package/lib/WebpackError.js +6 -6
- package/lib/WebpackOptionsApply.js +18 -5
- package/lib/asset/RawDataUrlModule.js +3 -1
- package/lib/async-modules/AwaitDependenciesInitFragment.js +2 -2
- package/lib/buildChunkGraph.js +117 -64
- package/lib/cache/IdleFileCachePlugin.js +8 -3
- package/lib/cache/MemoryCachePlugin.js +1 -1
- package/lib/cache/MemoryWithGcCachePlugin.js +6 -2
- package/lib/cache/PackFileCacheStrategy.js +49 -16
- package/lib/cache/ResolverCachePlugin.js +14 -6
- package/lib/cache/getLazyHashedEtag.js +1 -1
- package/lib/config/defaults.js +24 -1
- package/lib/config/normalization.js +3 -1
- package/lib/container/ContainerEntryDependency.js +2 -1
- package/lib/container/ContainerEntryModule.js +3 -1
- package/lib/container/ContainerPlugin.js +14 -10
- package/lib/container/FallbackModule.js +1 -1
- package/lib/container/RemoteRuntimeModule.js +12 -3
- package/lib/css/CssExportsGenerator.js +34 -17
- package/lib/css/CssGenerator.js +20 -2
- package/lib/css/CssLoadingRuntimeModule.js +212 -96
- package/lib/css/CssModulesPlugin.js +47 -13
- package/lib/debug/ProfilingPlugin.js +27 -2
- package/lib/dependencies/AMDDefineDependencyParserPlugin.js +9 -5
- package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +4 -1
- package/lib/dependencies/CommonJsDependencyHelpers.js +2 -1
- package/lib/dependencies/CommonJsExportRequireDependency.js +33 -18
- package/lib/dependencies/CommonJsExportsDependency.js +13 -5
- package/lib/dependencies/CommonJsExportsParserPlugin.js +20 -15
- package/lib/dependencies/CommonJsImportsParserPlugin.js +1 -2
- package/lib/dependencies/ContextDependencyHelpers.js +49 -29
- package/lib/dependencies/ContextElementDependency.js +8 -1
- package/lib/dependencies/CssLocalIdentifierDependency.js +63 -8
- package/lib/dependencies/CssUrlDependency.js +5 -3
- package/lib/dependencies/ExportsInfoDependency.js +4 -3
- package/lib/dependencies/ExternalModuleInitFragment.js +5 -3
- package/lib/dependencies/HarmonyEvaluatedImportSpecifierDependency.js +4 -4
- package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +43 -23
- package/lib/dependencies/HarmonyExportHeaderDependency.js +1 -1
- package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +73 -32
- package/lib/dependencies/HarmonyExportInitFragment.js +10 -2
- package/lib/dependencies/HarmonyImportDependency.js +28 -12
- package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +44 -16
- package/lib/dependencies/HarmonyImportSideEffectDependency.js +7 -6
- package/lib/dependencies/HarmonyImportSpecifierDependency.js +6 -5
- package/lib/dependencies/ImportDependency.js +9 -2
- package/lib/dependencies/ImportEagerDependency.js +4 -2
- package/lib/dependencies/ImportMetaContextDependency.js +7 -0
- package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +25 -14
- package/lib/dependencies/ImportParserPlugin.js +12 -4
- package/lib/dependencies/ImportWeakDependency.js +4 -2
- package/lib/dependencies/LoaderDependency.js +2 -1
- package/lib/dependencies/LoaderImportDependency.js +2 -1
- package/lib/dependencies/ModuleDependency.js +4 -5
- package/lib/dependencies/PureExpressionDependency.js +4 -1
- package/lib/dependencies/RequireContextPlugin.js +1 -1
- package/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js +26 -14
- package/lib/dependencies/RequireEnsureDependency.js +1 -1
- package/lib/dependencies/URLDependency.js +7 -4
- package/lib/dependencies/WorkerPlugin.js +2 -1
- package/lib/dependencies/getFunctionExpression.js +3 -1
- package/lib/esm/ModuleChunkLoadingRuntimeModule.js +2 -1
- package/lib/javascript/BasicEvaluatedExpression.js +2 -2
- package/lib/javascript/ChunkHelpers.js +2 -2
- package/lib/javascript/JavascriptParser.js +169 -57
- package/lib/javascript/JavascriptParserHelpers.js +1 -1
- package/lib/javascript/StartupHelpers.js +22 -5
- package/lib/logging/Logger.js +27 -2
- package/lib/logging/createConsoleLogger.js +11 -7
- package/lib/node/NodeEnvironmentPlugin.js +13 -7
- package/lib/node/NodeWatchFileSystem.js +37 -26
- package/lib/node/ReadFileChunkLoadingRuntimeModule.js +2 -1
- package/lib/node/RequireChunkLoadingRuntimeModule.js +2 -1
- package/lib/node/nodeConsole.js +24 -1
- package/lib/optimize/AggressiveSplittingPlugin.js +1 -0
- package/lib/optimize/ConcatenatedModule.js +138 -54
- package/lib/optimize/EnsureChunkConditionsPlugin.js +1 -1
- package/lib/optimize/InnerGraph.js +7 -2
- package/lib/optimize/InnerGraphPlugin.js +36 -13
- package/lib/optimize/ModuleConcatenationPlugin.js +12 -2
- package/lib/optimize/RemoveParentModulesPlugin.js +1 -0
- package/lib/optimize/RuntimeChunkPlugin.js +6 -1
- package/lib/optimize/SideEffectsFlagPlugin.js +46 -15
- package/lib/optimize/SplitChunksPlugin.js +2 -2
- package/lib/performance/SizeLimitsPlugin.js +11 -0
- package/lib/rules/ObjectMatcherRulePlugin.js +4 -0
- package/lib/runtime/EnsureChunkRuntimeModule.js +2 -1
- package/lib/runtime/GetTrustedTypesPolicyRuntimeModule.js +2 -1
- package/lib/serialization/FileMiddleware.js +1 -0
- package/lib/serialization/ObjectMiddleware.js +2 -0
- package/lib/serialization/Serializer.js +19 -0
- package/lib/sharing/ConsumeSharedModule.js +1 -1
- package/lib/sharing/ConsumeSharedPlugin.js +17 -3
- package/lib/sharing/ConsumeSharedRuntimeModule.js +9 -2
- package/lib/sharing/ProvideSharedPlugin.js +12 -5
- package/lib/sharing/resolveMatchedConfigs.js +2 -2
- package/lib/sharing/utils.js +13 -6
- package/lib/util/StackedCacheMap.js +26 -0
- package/lib/util/WeakTupleMap.js +57 -13
- package/lib/util/cleverMerge.js +24 -11
- package/lib/util/comparators.js +34 -14
- package/lib/util/conventions.js +129 -0
- package/lib/util/fs.js +379 -65
- package/lib/util/hash/BatchedHash.js +3 -0
- package/lib/util/hash/xxhash64.js +2 -2
- package/lib/util/runtime.js +1 -1
- package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +4 -2
- package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +15 -6
- package/lib/wasm-sync/WebAssemblyGenerator.js +27 -6
- package/lib/wasm-sync/WebAssemblyParser.js +7 -4
- package/lib/web/JsonpChunkLoadingRuntimeModule.js +2 -1
- package/lib/webpack.js +7 -3
- package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +2 -1
- package/package.json +25 -26
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +69 -8
- package/schemas/plugins/BannerPlugin.check.js +1 -1
- package/schemas/plugins/BannerPlugin.json +5 -1
- package/schemas/plugins/css/CssAutoGeneratorOptions.check.js +1 -1
- package/schemas/plugins/css/CssGeneratorOptions.check.js +1 -1
- package/schemas/plugins/css/CssGlobalGeneratorOptions.check.js +1 -1
- package/schemas/plugins/css/CssModuleGeneratorOptions.check.js +1 -1
- package/types.d.ts +1668 -613
package/lib/Watching.js
CHANGED
@@ -13,11 +13,12 @@ const Stats = require("./Stats");
|
|
13
13
|
/** @typedef {import("./FileSystemInfo").FileSystemInfoEntry} FileSystemInfoEntry */
|
14
14
|
/** @typedef {import("./WebpackError")} WebpackError */
|
15
15
|
/** @typedef {import("./logging/Logger").Logger} Logger */
|
16
|
+
/** @typedef {import("./util/fs").WatchFileSystem} WatchFileSystem */
|
16
17
|
|
17
18
|
/**
|
18
19
|
* @template T
|
19
20
|
* @callback Callback
|
20
|
-
* @param {
|
21
|
+
* @param {Error | null} err
|
21
22
|
* @param {T=} result
|
22
23
|
*/
|
23
24
|
|
@@ -171,8 +172,16 @@ class Watching {
|
|
171
172
|
this._invalidReported = false;
|
172
173
|
this.compiler.hooks.watchRun.callAsync(this.compiler, err => {
|
173
174
|
if (err) return this._done(err);
|
174
|
-
|
175
|
-
|
175
|
+
/**
|
176
|
+
* @param {Error | null} err error
|
177
|
+
* @param {Compilation=} _compilation compilation
|
178
|
+
* @returns {void}
|
179
|
+
*/
|
180
|
+
const onCompiled = (err, _compilation) => {
|
181
|
+
if (err) return this._done(err, _compilation);
|
182
|
+
|
183
|
+
const compilation = /** @type {Compilation} */ (_compilation);
|
184
|
+
|
176
185
|
if (this.invalid) return this._done(null, compilation);
|
177
186
|
|
178
187
|
if (this.compiler.hooks.shouldEmit.call(compilation) === false) {
|
@@ -195,7 +204,9 @@ class Watching {
|
|
195
204
|
if (compilation.hooks.needAdditionalPass.call()) {
|
196
205
|
compilation.needAdditionalPass = true;
|
197
206
|
|
198
|
-
compilation.startTime =
|
207
|
+
compilation.startTime = /** @type {number} */ (
|
208
|
+
this.startTime
|
209
|
+
);
|
199
210
|
compilation.endTime = Date.now();
|
200
211
|
logger.time("done hook");
|
201
212
|
const stats = new Stats(compilation);
|
@@ -239,10 +250,12 @@ class Watching {
|
|
239
250
|
_done(err, compilation) {
|
240
251
|
this.running = false;
|
241
252
|
|
242
|
-
const logger =
|
253
|
+
const logger =
|
254
|
+
/** @type {Logger} */
|
255
|
+
(compilation && compilation.getLogger("webpack.Watching"));
|
243
256
|
|
244
|
-
/** @type {Stats |
|
245
|
-
let stats =
|
257
|
+
/** @type {Stats | undefined} */
|
258
|
+
let stats = undefined;
|
246
259
|
|
247
260
|
/**
|
248
261
|
* @param {Error} err error
|
@@ -267,13 +280,11 @@ class Watching {
|
|
267
280
|
!(this._isBlocked() && (this.blocked = true))
|
268
281
|
) {
|
269
282
|
if (compilation) {
|
270
|
-
|
271
|
-
(logger).time("storeBuildDependencies");
|
283
|
+
logger.time("storeBuildDependencies");
|
272
284
|
this.compiler.cache.storeBuildDependencies(
|
273
285
|
compilation.buildDependencies,
|
274
286
|
err => {
|
275
|
-
|
276
|
-
(logger).timeEnd("storeBuildDependencies");
|
287
|
+
logger.timeEnd("storeBuildDependencies");
|
277
288
|
if (err) return handleError(err);
|
278
289
|
this._go();
|
279
290
|
}
|
@@ -285,7 +296,7 @@ class Watching {
|
|
285
296
|
}
|
286
297
|
|
287
298
|
if (compilation) {
|
288
|
-
compilation.startTime = this.startTime;
|
299
|
+
compilation.startTime = /** @type {number} */ (this.startTime);
|
289
300
|
compilation.endTime = Date.now();
|
290
301
|
stats = new Stats(compilation);
|
291
302
|
}
|
@@ -294,28 +305,22 @@ class Watching {
|
|
294
305
|
|
295
306
|
const cbs = this.callbacks;
|
296
307
|
this.callbacks = [];
|
297
|
-
|
298
|
-
(logger).time("done hook");
|
308
|
+
logger.time("done hook");
|
299
309
|
this.compiler.hooks.done.callAsync(/** @type {Stats} */ (stats), err => {
|
300
|
-
|
301
|
-
(logger).timeEnd("done hook");
|
310
|
+
logger.timeEnd("done hook");
|
302
311
|
if (err) return handleError(err, cbs);
|
303
|
-
this.handler(null,
|
304
|
-
|
305
|
-
(logger).time("storeBuildDependencies");
|
312
|
+
this.handler(null, stats);
|
313
|
+
logger.time("storeBuildDependencies");
|
306
314
|
this.compiler.cache.storeBuildDependencies(
|
307
315
|
/** @type {Compilation} */
|
308
316
|
(compilation).buildDependencies,
|
309
317
|
err => {
|
310
|
-
|
311
|
-
(logger).timeEnd("storeBuildDependencies");
|
318
|
+
logger.timeEnd("storeBuildDependencies");
|
312
319
|
if (err) return handleError(err, cbs);
|
313
|
-
|
314
|
-
(logger).time("beginIdle");
|
320
|
+
logger.time("beginIdle");
|
315
321
|
this.compiler.cache.beginIdle();
|
316
322
|
this.compiler.idle = true;
|
317
|
-
|
318
|
-
(logger).timeEnd("beginIdle");
|
323
|
+
logger.timeEnd("beginIdle");
|
319
324
|
process.nextTick(() => {
|
320
325
|
if (!this.closed) {
|
321
326
|
this.watch(
|
@@ -343,43 +348,45 @@ class Watching {
|
|
343
348
|
*/
|
344
349
|
watch(files, dirs, missing) {
|
345
350
|
this.pausedWatcher = null;
|
346
|
-
this.watcher =
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
changedFiles,
|
357
|
-
removedFiles
|
358
|
-
) => {
|
359
|
-
if (err) {
|
360
|
-
this.compiler.modifiedFiles = undefined;
|
361
|
-
this.compiler.removedFiles = undefined;
|
362
|
-
this.compiler.fileTimestamps = undefined;
|
363
|
-
this.compiler.contextTimestamps = undefined;
|
364
|
-
this.compiler.fsStartTime = undefined;
|
365
|
-
return this.handler(err);
|
366
|
-
}
|
367
|
-
this._invalidate(
|
351
|
+
this.watcher =
|
352
|
+
/** @type {WatchFileSystem} */
|
353
|
+
(this.compiler.watchFileSystem).watch(
|
354
|
+
files,
|
355
|
+
dirs,
|
356
|
+
missing,
|
357
|
+
/** @type {number} */ (this.lastWatcherStartTime),
|
358
|
+
this.watchOptions,
|
359
|
+
(
|
360
|
+
err,
|
368
361
|
fileTimeInfoEntries,
|
369
362
|
contextTimeInfoEntries,
|
370
363
|
changedFiles,
|
371
364
|
removedFiles
|
372
|
-
)
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
365
|
+
) => {
|
366
|
+
if (err) {
|
367
|
+
this.compiler.modifiedFiles = undefined;
|
368
|
+
this.compiler.removedFiles = undefined;
|
369
|
+
this.compiler.fileTimestamps = undefined;
|
370
|
+
this.compiler.contextTimestamps = undefined;
|
371
|
+
this.compiler.fsStartTime = undefined;
|
372
|
+
return this.handler(err);
|
373
|
+
}
|
374
|
+
this._invalidate(
|
375
|
+
fileTimeInfoEntries,
|
376
|
+
contextTimeInfoEntries,
|
377
|
+
changedFiles,
|
378
|
+
removedFiles
|
379
|
+
);
|
380
|
+
this._onChange();
|
381
|
+
},
|
382
|
+
(fileName, changeTime) => {
|
383
|
+
if (!this._invalidReported) {
|
384
|
+
this._invalidReported = true;
|
385
|
+
this.compiler.hooks.invalid.call(fileName, changeTime);
|
386
|
+
}
|
387
|
+
this._onInvalid();
|
379
388
|
}
|
380
|
-
|
381
|
-
}
|
382
|
-
);
|
389
|
+
);
|
383
390
|
}
|
384
391
|
|
385
392
|
/**
|
@@ -452,7 +459,7 @@ class Watching {
|
|
452
459
|
return;
|
453
460
|
}
|
454
461
|
/**
|
455
|
-
* @param {
|
462
|
+
* @param {WebpackError | null} err error if any
|
456
463
|
* @param {Compilation=} compilation compilation if any
|
457
464
|
*/
|
458
465
|
const finalCallback = (err, compilation) => {
|
@@ -466,7 +473,7 @@ class Watching {
|
|
466
473
|
this.compiler.contextTimestamps = undefined;
|
467
474
|
this.compiler.fsStartTime = undefined;
|
468
475
|
/**
|
469
|
-
* @param {
|
476
|
+
* @param {WebpackError | null} err error if any
|
470
477
|
*/
|
471
478
|
const shutdown = err => {
|
472
479
|
this.compiler.hooks.watchClose.call();
|
@@ -508,7 +515,7 @@ class Watching {
|
|
508
515
|
this.invalid = true;
|
509
516
|
this._done = finalCallback;
|
510
517
|
} else {
|
511
|
-
finalCallback();
|
518
|
+
finalCallback(null);
|
512
519
|
}
|
513
520
|
}
|
514
521
|
}
|
package/lib/WebpackError.js
CHANGED
@@ -22,17 +22,17 @@ class WebpackError extends Error {
|
|
22
22
|
constructor(message) {
|
23
23
|
super(message);
|
24
24
|
|
25
|
-
/** @type {string
|
25
|
+
/** @type {string=} */
|
26
26
|
this.details = undefined;
|
27
|
-
/** @type {Module |
|
27
|
+
/** @type {(Module | null)=} */
|
28
28
|
this.module = undefined;
|
29
|
-
/** @type {DependencyLocation
|
29
|
+
/** @type {DependencyLocation=} */
|
30
30
|
this.loc = undefined;
|
31
|
-
/** @type {boolean
|
31
|
+
/** @type {boolean=} */
|
32
32
|
this.hideStack = undefined;
|
33
|
-
/** @type {Chunk
|
33
|
+
/** @type {Chunk=} */
|
34
34
|
this.chunk = undefined;
|
35
|
-
/** @type {string
|
35
|
+
/** @type {string=} */
|
36
36
|
this.file = undefined;
|
37
37
|
}
|
38
38
|
|
@@ -57,6 +57,8 @@ const { cleverMerge } = require("./util/cleverMerge");
|
|
57
57
|
|
58
58
|
/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */
|
59
59
|
/** @typedef {import("./Compiler")} Compiler */
|
60
|
+
/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */
|
61
|
+
/** @typedef {import("./util/fs").IntermediateFileSystem} IntermediateFileSystem */
|
60
62
|
|
61
63
|
class WebpackOptionsApply extends OptionsApply {
|
62
64
|
constructor() {
|
@@ -455,7 +457,10 @@ class WebpackOptionsApply extends OptionsApply {
|
|
455
457
|
}
|
456
458
|
if (options.optimization.runtimeChunk) {
|
457
459
|
const RuntimeChunkPlugin = require("./optimize/RuntimeChunkPlugin");
|
458
|
-
new RuntimeChunkPlugin(
|
460
|
+
new RuntimeChunkPlugin(
|
461
|
+
/** @type {{ name?: (entrypoint: { name: string }) => string }} */
|
462
|
+
(options.optimization.runtimeChunk)
|
463
|
+
).apply(compiler);
|
459
464
|
}
|
460
465
|
if (!options.optimization.emitOnErrors) {
|
461
466
|
const NoEmitOnErrorsPlugin = require("./NoEmitOnErrorsPlugin");
|
@@ -649,7 +654,9 @@ class WebpackOptionsApply extends OptionsApply {
|
|
649
654
|
new IdleFileCachePlugin(
|
650
655
|
new PackFileCacheStrategy({
|
651
656
|
compiler,
|
652
|
-
fs:
|
657
|
+
fs: /** @type {IntermediateFileSystem} */ (
|
658
|
+
compiler.intermediateFileSystem
|
659
|
+
),
|
653
660
|
context: options.context,
|
654
661
|
cacheLocation: cacheOptions.cacheLocation,
|
655
662
|
version: cacheOptions.version,
|
@@ -694,14 +701,18 @@ class WebpackOptionsApply extends OptionsApply {
|
|
694
701
|
.for("normal")
|
695
702
|
.tap("WebpackOptionsApply", resolveOptions => {
|
696
703
|
resolveOptions = cleverMerge(options.resolve, resolveOptions);
|
697
|
-
resolveOptions.fileSystem =
|
704
|
+
resolveOptions.fileSystem =
|
705
|
+
/** @type {InputFileSystem} */
|
706
|
+
(compiler.inputFileSystem);
|
698
707
|
return resolveOptions;
|
699
708
|
});
|
700
709
|
compiler.resolverFactory.hooks.resolveOptions
|
701
710
|
.for("context")
|
702
711
|
.tap("WebpackOptionsApply", resolveOptions => {
|
703
712
|
resolveOptions = cleverMerge(options.resolve, resolveOptions);
|
704
|
-
resolveOptions.fileSystem =
|
713
|
+
resolveOptions.fileSystem =
|
714
|
+
/** @type {InputFileSystem} */
|
715
|
+
(compiler.inputFileSystem);
|
705
716
|
resolveOptions.resolveToContext = true;
|
706
717
|
return resolveOptions;
|
707
718
|
});
|
@@ -709,7 +720,9 @@ class WebpackOptionsApply extends OptionsApply {
|
|
709
720
|
.for("loader")
|
710
721
|
.tap("WebpackOptionsApply", resolveOptions => {
|
711
722
|
resolveOptions = cleverMerge(options.resolveLoader, resolveOptions);
|
712
|
-
resolveOptions.fileSystem =
|
723
|
+
resolveOptions.fileSystem =
|
724
|
+
/** @type {InputFileSystem} */
|
725
|
+
(compiler.inputFileSystem);
|
713
726
|
return resolveOptions;
|
714
727
|
});
|
715
728
|
compiler.hooks.afterResolvers.call(compiler);
|
@@ -71,7 +71,9 @@ class RawDataUrlModule extends Module {
|
|
71
71
|
* @returns {string} a user readable identifier of the module
|
72
72
|
*/
|
73
73
|
readableIdentifier(requestShortener) {
|
74
|
-
return
|
74
|
+
return /** @type {string} */ (
|
75
|
+
requestShortener.shorten(this.readableIdentifierStr)
|
76
|
+
);
|
75
77
|
}
|
76
78
|
|
77
79
|
/**
|
@@ -13,7 +13,7 @@ const Template = require("../Template");
|
|
13
13
|
/** @typedef {import("../Generator").GenerateContext} GenerateContext */
|
14
14
|
|
15
15
|
/**
|
16
|
-
* @
|
16
|
+
* @extends {InitFragment<GenerateContext>}
|
17
17
|
*/
|
18
18
|
class AwaitDependenciesInitFragment extends InitFragment {
|
19
19
|
/**
|
@@ -43,7 +43,7 @@ class AwaitDependenciesInitFragment extends InitFragment {
|
|
43
43
|
|
44
44
|
/**
|
45
45
|
* @param {GenerateContext} context context
|
46
|
-
* @returns {string | Source} the source code that will be included as initialization code
|
46
|
+
* @returns {string | Source | undefined} the source code that will be included as initialization code
|
47
47
|
*/
|
48
48
|
getContent({ runtimeRequirements }) {
|
49
49
|
runtimeRequirements.add(RuntimeGlobals.module);
|