webpack 5.38.1 → 5.39.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 +20 -5
- package/lib/AsyncDependencyToInitialChunkError.js +0 -2
- package/lib/CaseSensitiveModulesWarning.js +0 -2
- package/lib/Chunk.js +6 -2
- package/lib/ChunkRenderError.js +0 -2
- package/lib/CodeGenerationError.js +0 -2
- package/lib/CommentCompilationWarning.js +0 -2
- package/lib/ConcurrentCompilationError.js +0 -2
- package/lib/ContextModule.js +2 -1
- package/lib/ContextModuleFactory.js +3 -1
- package/lib/DllReferencePlugin.js +0 -2
- package/lib/HarmonyLinkingError.js +0 -2
- package/lib/HookWebpackError.js +0 -1
- package/lib/InvalidDependenciesModuleWarning.js +0 -2
- package/lib/ModuleBuildError.js +0 -2
- package/lib/ModuleDependencyError.js +0 -2
- package/lib/ModuleDependencyWarning.js +0 -2
- package/lib/ModuleError.js +0 -2
- package/lib/ModuleNotFoundError.js +0 -2
- package/lib/ModuleParseError.js +0 -2
- package/lib/ModuleRestoreError.js +0 -2
- package/lib/ModuleStoreError.js +0 -2
- package/lib/ModuleWarning.js +0 -2
- package/lib/NoModeWarning.js +0 -2
- package/lib/NormalModule.js +0 -2
- package/lib/UnsupportedFeatureWarning.js +0 -2
- package/lib/WarnDeprecatedOptionPlugin.js +0 -2
- package/lib/WebpackError.js +0 -2
- package/lib/config/normalization.js +1 -0
- package/lib/dependencies/ContextElementDependency.js +6 -1
- package/lib/dependencies/CriticalDependencyWarning.js +0 -2
- package/lib/dependencies/ImportParserPlugin.js +1 -0
- package/lib/dependencies/RequireIncludeDependencyParserPlugin.js +0 -2
- package/lib/dependencies/SystemPlugin.js +0 -2
- package/lib/errors/BuildCycleError.js +0 -1
- package/lib/hmr/LazyCompilationPlugin.js +3 -1
- package/lib/performance/AssetsOverSizeLimitWarning.js +0 -2
- package/lib/performance/EntrypointsOverSizeLimitWarning.js +0 -2
- package/lib/performance/NoAsyncChunksWarning.js +0 -2
- package/lib/wasm-sync/UnsupportedWebAssemblyFeatureError.js +0 -2
- package/lib/wasm-sync/WebAssemblyInInitialChunkError.js +0 -2
- package/package.json +1 -1
- package/types.d.ts +1 -0
package/bin/webpack.js
CHANGED
@@ -32,13 +32,28 @@ const runCommand = (command, args) => {
|
|
32
32
|
* @returns {boolean} is the package installed?
|
33
33
|
*/
|
34
34
|
const isInstalled = packageName => {
|
35
|
-
|
36
|
-
require.resolve(packageName);
|
37
|
-
|
35
|
+
if (process.versions.pnp) {
|
38
36
|
return true;
|
39
|
-
} catch (err) {
|
40
|
-
return false;
|
41
37
|
}
|
38
|
+
|
39
|
+
const path = require("path");
|
40
|
+
const fs = require("graceful-fs");
|
41
|
+
|
42
|
+
let dir = __dirname;
|
43
|
+
|
44
|
+
do {
|
45
|
+
try {
|
46
|
+
if (
|
47
|
+
fs.statSync(path.join(dir, "node_modules", packageName)).isDirectory()
|
48
|
+
) {
|
49
|
+
return true;
|
50
|
+
}
|
51
|
+
} catch (_error) {
|
52
|
+
// Nothing
|
53
|
+
}
|
54
|
+
} while (dir !== (dir = path.dirname(dir)));
|
55
|
+
|
56
|
+
return false;
|
42
57
|
};
|
43
58
|
|
44
59
|
/**
|
package/lib/Chunk.js
CHANGED
@@ -598,8 +598,12 @@ class Chunk {
|
|
598
598
|
*/
|
599
599
|
getAllInitialChunks() {
|
600
600
|
const chunks = new Set();
|
601
|
-
|
602
|
-
|
601
|
+
const queue = new Set(this.groupsIterable);
|
602
|
+
for (const group of queue) {
|
603
|
+
if (group.isInitial()) {
|
604
|
+
for (const c of group.chunks) chunks.add(c);
|
605
|
+
for (const g of group.childrenIterable) queue.add(g);
|
606
|
+
}
|
603
607
|
}
|
604
608
|
return chunks;
|
605
609
|
}
|
package/lib/ChunkRenderError.js
CHANGED
@@ -14,7 +14,5 @@ module.exports = class ConcurrentCompilationError extends WebpackError {
|
|
14
14
|
this.name = "ConcurrentCompilationError";
|
15
15
|
this.message =
|
16
16
|
"You ran Webpack twice. Each instance only supports a single concurrent compilation at a time.";
|
17
|
-
|
18
|
-
Error.captureStackTrace(this, this.constructor);
|
19
17
|
}
|
20
18
|
};
|
package/lib/ContextModule.js
CHANGED
@@ -54,6 +54,7 @@ const makeSerializable = require("./util/makeSerializable");
|
|
54
54
|
* @property {RegExp=} include
|
55
55
|
* @property {RegExp=} exclude
|
56
56
|
* @property {RawChunkGroupOptions=} groupOptions
|
57
|
+
* @property {string=} typePrefix
|
57
58
|
* @property {string=} category
|
58
59
|
* @property {string[][]=} referencedExports exports referenced from modules (won't be mangled)
|
59
60
|
*/
|
@@ -577,7 +578,7 @@ class ContextModule extends Module {
|
|
577
578
|
fakeMapDataExpression = "fakeMap[id]"
|
578
579
|
) {
|
579
580
|
if (typeof fakeMap === "number") {
|
580
|
-
return `return ${this.getReturn(fakeMap)};`;
|
581
|
+
return `return ${this.getReturn(fakeMap, asyncModule)};`;
|
581
582
|
}
|
582
583
|
return `return ${
|
583
584
|
RuntimeGlobals.createFakeNamespaceObject
|
@@ -273,7 +273,8 @@ module.exports = class ContextModuleFactory extends ModuleFactory {
|
|
273
273
|
include,
|
274
274
|
exclude,
|
275
275
|
referencedExports,
|
276
|
-
category
|
276
|
+
category,
|
277
|
+
typePrefix
|
277
278
|
} = options;
|
278
279
|
if (!regExp || !resource) return callback(null, []);
|
279
280
|
|
@@ -346,6 +347,7 @@ module.exports = class ContextModuleFactory extends ModuleFactory {
|
|
346
347
|
const dep = new ContextElementDependency(
|
347
348
|
obj.request + resourceQuery + resourceFragment,
|
348
349
|
obj.request,
|
350
|
+
typePrefix,
|
349
351
|
category,
|
350
352
|
referencedExports
|
351
353
|
);
|
package/lib/HookWebpackError.js
CHANGED
package/lib/ModuleBuildError.js
CHANGED
@@ -30,8 +30,6 @@ class ModuleDependencyError extends WebpackError {
|
|
30
30
|
/** error is not (de)serialized, so it might be undefined after deserialization */
|
31
31
|
this.error = err;
|
32
32
|
|
33
|
-
Error.captureStackTrace(this, this.constructor);
|
34
|
-
|
35
33
|
if (err && /** @type {any} */ (err).hideStack) {
|
36
34
|
this.stack =
|
37
35
|
err.stack.split("\n").slice(1).join("\n") + "\n\n" + this.stack;
|
@@ -30,8 +30,6 @@ class ModuleDependencyWarning extends WebpackError {
|
|
30
30
|
/** error is not (de)serialized, so it might be undefined after deserialization */
|
31
31
|
this.error = err;
|
32
32
|
|
33
|
-
Error.captureStackTrace(this, this.constructor);
|
34
|
-
|
35
33
|
if (err && /** @type {any} */ (err).hideStack) {
|
36
34
|
this.stack =
|
37
35
|
err.stack.split("\n").slice(1).join("\n") + "\n\n" + this.stack;
|
package/lib/ModuleError.js
CHANGED
package/lib/ModuleParseError.js
CHANGED
package/lib/ModuleStoreError.js
CHANGED
package/lib/ModuleWarning.js
CHANGED
package/lib/NoModeWarning.js
CHANGED
@@ -18,7 +18,5 @@ module.exports = class NoModeWarning extends WebpackError {
|
|
18
18
|
"Set 'mode' option to 'development' or 'production' to enable defaults for each environment.\n" +
|
19
19
|
"You can also set it to 'none' to disable any default behavior. " +
|
20
20
|
"Learn more: https://webpack.js.org/configuration/mode/";
|
21
|
-
|
22
|
-
Error.captureStackTrace(this, this.constructor);
|
23
21
|
}
|
24
22
|
};
|
package/lib/NormalModule.js
CHANGED
package/lib/WebpackError.js
CHANGED
@@ -129,6 +129,7 @@ const getNormalizedWebpackOptions = config => {
|
|
129
129
|
case "filesystem":
|
130
130
|
return {
|
131
131
|
type: "filesystem",
|
132
|
+
allowCollectingMemory: cache.allowCollectingMemory,
|
132
133
|
maxMemoryGenerations: cache.maxMemoryGenerations,
|
133
134
|
maxAge: cache.maxAge,
|
134
135
|
profile: cache.profile,
|
@@ -14,9 +14,10 @@ const ModuleDependency = require("./ModuleDependency");
|
|
14
14
|
/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */
|
15
15
|
|
16
16
|
class ContextElementDependency extends ModuleDependency {
|
17
|
-
constructor(request, userRequest, category, referencedExports) {
|
17
|
+
constructor(request, userRequest, typePrefix, category, referencedExports) {
|
18
18
|
super(request);
|
19
19
|
this.referencedExports = referencedExports;
|
20
|
+
this._typePrefix = typePrefix;
|
20
21
|
this._category = category;
|
21
22
|
|
22
23
|
if (userRequest) {
|
@@ -25,6 +26,10 @@ class ContextElementDependency extends ModuleDependency {
|
|
25
26
|
}
|
26
27
|
|
27
28
|
get type() {
|
29
|
+
if (this._typePrefix) {
|
30
|
+
return `${this._typePrefix} context element`;
|
31
|
+
}
|
32
|
+
|
28
33
|
return "context element";
|
29
34
|
}
|
30
35
|
|
@@ -350,7 +350,9 @@ class LazyCompilationPlugin {
|
|
350
350
|
resolveData.dependencies.every(
|
351
351
|
dep =>
|
352
352
|
IGNORED_DEPENDENCY_TYPES.has(dep.type) ||
|
353
|
-
(this.imports &&
|
353
|
+
(this.imports &&
|
354
|
+
(dep.type === "import()" ||
|
355
|
+
dep.type === "import() context element")) ||
|
354
356
|
(this.entries && dep.type === "entry")
|
355
357
|
) &&
|
356
358
|
!/webpack[/\\]hot[/\\]|webpack-dev-server[/\\]client/.test(
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "webpack",
|
3
|
-
"version": "5.
|
3
|
+
"version": "5.39.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",
|