webpack 5.61.0 → 5.63.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/lib/Chunk.js +3 -2
- package/lib/Compilation.js +36 -20
- package/lib/Compiler.js +13 -11
- package/lib/FileSystemInfo.js +7 -6
- package/lib/HotModuleReplacementPlugin.js +3 -1
- package/lib/RuntimePlugin.js +9 -1
- package/lib/buildChunkGraph.js +25 -5
- package/lib/cache/PackFileCacheStrategy.js +3 -3
- package/lib/config/defaults.js +18 -10
- package/lib/config/normalization.js +1 -0
- package/lib/dependencies/AMDRequireDependency.js +6 -6
- package/lib/dependencies/CommonJsFullRequireDependency.js +5 -1
- package/lib/dependencies/CommonJsImportsParserPlugin.js +3 -1
- package/lib/dependencies/CommonJsRequireContextDependency.js +5 -1
- package/lib/dependencies/ContextDependency.js +1 -0
- package/lib/dependencies/ContextDependencyTemplateAsRequireCall.js +4 -1
- package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +12 -3
- package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +25 -17
- package/lib/dependencies/HarmonyImportDependency.js +23 -0
- package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +17 -4
- package/lib/dependencies/HarmonyImportSpecifierDependency.js +24 -14
- package/lib/dependencies/RequireEnsureDependency.js +2 -2
- package/lib/hmr/lazyCompilationBackend.js +6 -1
- package/lib/node/RequireChunkLoadingRuntimeModule.js +1 -1
- package/lib/optimize/ModuleConcatenationPlugin.js +5 -2
- package/lib/optimize/SplitChunksPlugin.js +8 -1
- package/lib/runtime/AsyncModuleRuntimeModule.js +2 -2
- package/lib/sharing/ConsumeSharedRuntimeModule.js +1 -1
- package/lib/sharing/ShareRuntimeModule.js +1 -1
- package/lib/stats/DefaultStatsPrinterPlugin.js +1 -1
- package/lib/util/deprecation.js +10 -2
- package/lib/util/hash/BatchedHash.js +5 -1
- package/lib/util/hash/wasm-hash.js +1 -1
- package/lib/webpack.js +1 -2
- package/module.d.ts +200 -0
- package/package.json +12 -10
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +45 -21
- package/types.d.ts +33 -13
@@ -11,6 +11,7 @@ const HarmonyExportExpressionDependency = require("./HarmonyExportExpressionDepe
|
|
11
11
|
const HarmonyExportHeaderDependency = require("./HarmonyExportHeaderDependency");
|
12
12
|
const HarmonyExportImportedSpecifierDependency = require("./HarmonyExportImportedSpecifierDependency");
|
13
13
|
const HarmonyExportSpecifierDependency = require("./HarmonyExportSpecifierDependency");
|
14
|
+
const { ExportPresenceModes } = require("./HarmonyImportDependency");
|
14
15
|
const {
|
15
16
|
harmonySpecifierTag,
|
16
17
|
getAssertions
|
@@ -21,10 +22,18 @@ const { HarmonyStarExportsList } = HarmonyExportImportedSpecifierDependency;
|
|
21
22
|
|
22
23
|
module.exports = class HarmonyExportDependencyParserPlugin {
|
23
24
|
constructor(options) {
|
24
|
-
this.
|
25
|
+
this.exportPresenceMode =
|
26
|
+
options.reexportExportsPresence !== undefined
|
27
|
+
? ExportPresenceModes.fromUserOption(options.reexportExportsPresence)
|
28
|
+
: options.exportsPresence !== undefined
|
29
|
+
? ExportPresenceModes.fromUserOption(options.exportsPresence)
|
30
|
+
: options.strictExportPresence
|
31
|
+
? ExportPresenceModes.ERROR
|
32
|
+
: ExportPresenceModes.AUTO;
|
25
33
|
}
|
26
34
|
|
27
35
|
apply(parser) {
|
36
|
+
const { exportPresenceMode } = this;
|
28
37
|
parser.hooks.export.tap(
|
29
38
|
"HarmonyExportDependencyParserPlugin",
|
30
39
|
statement => {
|
@@ -128,7 +137,7 @@ module.exports = class HarmonyExportDependencyParserPlugin {
|
|
128
137
|
name,
|
129
138
|
harmonyNamedExports,
|
130
139
|
null,
|
131
|
-
|
140
|
+
exportPresenceMode,
|
132
141
|
null,
|
133
142
|
settings.assertions
|
134
143
|
);
|
@@ -160,7 +169,7 @@ module.exports = class HarmonyExportDependencyParserPlugin {
|
|
160
169
|
name,
|
161
170
|
harmonyNamedExports,
|
162
171
|
harmonyStarExports && harmonyStarExports.slice(),
|
163
|
-
|
172
|
+
exportPresenceMode,
|
164
173
|
harmonyStarExports
|
165
174
|
);
|
166
175
|
if (harmonyStarExports) {
|
@@ -40,6 +40,8 @@ const processExportInfo = require("./processExportInfo");
|
|
40
40
|
|
41
41
|
/** @typedef {"missing"|"unused"|"empty-star"|"reexport-dynamic-default"|"reexport-named-default"|"reexport-namespace-object"|"reexport-fake-namespace-object"|"reexport-undefined"|"normal-reexport"|"dynamic-reexport"} ExportModeType */
|
42
42
|
|
43
|
+
const { ExportPresenceModes } = HarmonyImportDependency;
|
44
|
+
|
43
45
|
const idsSymbol = Symbol("HarmonyExportImportedSpecifierDependency.ids");
|
44
46
|
|
45
47
|
class NormalReexportItem {
|
@@ -325,7 +327,7 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
|
|
325
327
|
* @param {string | null} name the export name of for this module
|
326
328
|
* @param {Set<string>} activeExports other named exports in the module
|
327
329
|
* @param {ReadonlyArray<HarmonyExportImportedSpecifierDependency> | Iterable<HarmonyExportImportedSpecifierDependency>} otherStarExports other star exports in the module before this import
|
328
|
-
* @param {
|
330
|
+
* @param {number} exportPresenceMode mode of checking export names
|
329
331
|
* @param {HarmonyStarExportsList} allStarExports all star exports in the module
|
330
332
|
* @param {Record<string, any>=} assertions import assertions
|
331
333
|
*/
|
@@ -336,7 +338,7 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
|
|
336
338
|
name,
|
337
339
|
activeExports,
|
338
340
|
otherStarExports,
|
339
|
-
|
341
|
+
exportPresenceMode,
|
340
342
|
allStarExports,
|
341
343
|
assertions
|
342
344
|
) {
|
@@ -346,7 +348,7 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
|
|
346
348
|
this.name = name;
|
347
349
|
this.activeExports = activeExports;
|
348
350
|
this.otherStarExports = otherStarExports;
|
349
|
-
this.
|
351
|
+
this.exportPresenceMode = exportPresenceMode;
|
350
352
|
this.allStarExports = allStarExports;
|
351
353
|
}
|
352
354
|
|
@@ -735,20 +737,29 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
|
|
735
737
|
}
|
736
738
|
}
|
737
739
|
|
740
|
+
/**
|
741
|
+
* @param {ModuleGraph} moduleGraph module graph
|
742
|
+
* @returns {number} effective mode
|
743
|
+
*/
|
744
|
+
_getEffectiveExportPresenceLevel(moduleGraph) {
|
745
|
+
if (this.exportPresenceMode !== ExportPresenceModes.AUTO)
|
746
|
+
return this.exportPresenceMode;
|
747
|
+
return moduleGraph.getParentModule(this).buildMeta.strictHarmonyModule
|
748
|
+
? ExportPresenceModes.ERROR
|
749
|
+
: ExportPresenceModes.WARN;
|
750
|
+
}
|
751
|
+
|
738
752
|
/**
|
739
753
|
* Returns warnings
|
740
754
|
* @param {ModuleGraph} moduleGraph module graph
|
741
755
|
* @returns {WebpackError[]} warnings
|
742
756
|
*/
|
743
757
|
getWarnings(moduleGraph) {
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
) {
|
748
|
-
return null;
|
758
|
+
const exportsPresence = this._getEffectiveExportPresenceLevel(moduleGraph);
|
759
|
+
if (exportsPresence === ExportPresenceModes.WARN) {
|
760
|
+
return this._getErrors(moduleGraph);
|
749
761
|
}
|
750
|
-
|
751
|
-
return this._getErrors(moduleGraph);
|
762
|
+
return null;
|
752
763
|
}
|
753
764
|
|
754
765
|
/**
|
@@ -757,13 +768,10 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
|
|
757
768
|
* @returns {WebpackError[]} errors
|
758
769
|
*/
|
759
770
|
getErrors(moduleGraph) {
|
760
|
-
|
761
|
-
|
762
|
-
moduleGraph.getParentModule(this).buildMeta.strictHarmonyModule
|
763
|
-
) {
|
771
|
+
const exportsPresence = this._getEffectiveExportPresenceLevel(moduleGraph);
|
772
|
+
if (exportsPresence === ExportPresenceModes.ERROR) {
|
764
773
|
return this._getErrors(moduleGraph);
|
765
774
|
}
|
766
|
-
|
767
775
|
return null;
|
768
776
|
}
|
769
777
|
|
@@ -856,7 +864,7 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
|
|
856
864
|
write(this.name);
|
857
865
|
write(this.activeExports);
|
858
866
|
write(this.otherStarExports);
|
859
|
-
write(this.
|
867
|
+
write(this.exportPresenceMode);
|
860
868
|
write(this.allStarExports);
|
861
869
|
|
862
870
|
super.serialize(context);
|
@@ -870,7 +878,7 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
|
|
870
878
|
this.name = read();
|
871
879
|
this.activeExports = read();
|
872
880
|
this.otherStarExports = read();
|
873
|
-
this.
|
881
|
+
this.exportPresenceMode = read();
|
874
882
|
this.allStarExports = read();
|
875
883
|
|
876
884
|
super.deserialize(context);
|
@@ -27,6 +27,27 @@ const ModuleDependency = require("./ModuleDependency");
|
|
27
27
|
/** @typedef {import("../util/Hash")} Hash */
|
28
28
|
/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */
|
29
29
|
|
30
|
+
const ExportPresenceModes = {
|
31
|
+
NONE: /** @type {0} */ (0),
|
32
|
+
WARN: /** @type {1} */ (1),
|
33
|
+
AUTO: /** @type {2} */ (2),
|
34
|
+
ERROR: /** @type {3} */ (3),
|
35
|
+
fromUserOption(str) {
|
36
|
+
switch (str) {
|
37
|
+
case "error":
|
38
|
+
return ExportPresenceModes.ERROR;
|
39
|
+
case "warn":
|
40
|
+
return ExportPresenceModes.WARN;
|
41
|
+
case "auto":
|
42
|
+
return ExportPresenceModes.AUTO;
|
43
|
+
case false:
|
44
|
+
return ExportPresenceModes.NONE;
|
45
|
+
default:
|
46
|
+
throw new Error(`Invalid export presence value ${str}`);
|
47
|
+
}
|
48
|
+
}
|
49
|
+
};
|
50
|
+
|
30
51
|
class HarmonyImportDependency extends ModuleDependency {
|
31
52
|
/**
|
32
53
|
*
|
@@ -334,3 +355,5 @@ HarmonyImportDependency.Template = class HarmonyImportDependencyTemplate extends
|
|
334
355
|
return emittedModules.get(referencedModule) || false;
|
335
356
|
}
|
336
357
|
};
|
358
|
+
|
359
|
+
module.exports.ExportPresenceModes = ExportPresenceModes;
|
@@ -11,6 +11,7 @@ const ConstDependency = require("./ConstDependency");
|
|
11
11
|
const HarmonyAcceptDependency = require("./HarmonyAcceptDependency");
|
12
12
|
const HarmonyAcceptImportDependency = require("./HarmonyAcceptImportDependency");
|
13
13
|
const HarmonyExports = require("./HarmonyExports");
|
14
|
+
const { ExportPresenceModes } = require("./HarmonyImportDependency");
|
14
15
|
const HarmonyImportSideEffectDependency = require("./HarmonyImportSideEffectDependency");
|
15
16
|
const HarmonyImportSpecifierDependency = require("./HarmonyImportSpecifierDependency");
|
16
17
|
|
@@ -19,6 +20,7 @@ const HarmonyImportSpecifierDependency = require("./HarmonyImportSpecifierDepend
|
|
19
20
|
/** @typedef {import("estree").Identifier} Identifier */
|
20
21
|
/** @typedef {import("estree").ImportDeclaration} ImportDeclaration */
|
21
22
|
/** @typedef {import("estree").ImportExpression} ImportExpression */
|
23
|
+
/** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */
|
22
24
|
/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */
|
23
25
|
/** @typedef {import("../optimize/InnerGraph").InnerGraph} InnerGraph */
|
24
26
|
/** @typedef {import("../optimize/InnerGraph").TopLevelSymbol} TopLevelSymbol */
|
@@ -60,8 +62,18 @@ function getAssertions(node) {
|
|
60
62
|
}
|
61
63
|
|
62
64
|
module.exports = class HarmonyImportDependencyParserPlugin {
|
65
|
+
/**
|
66
|
+
* @param {JavascriptParserOptions} options options
|
67
|
+
*/
|
63
68
|
constructor(options) {
|
64
|
-
this.
|
69
|
+
this.exportPresenceMode =
|
70
|
+
options.importExportsPresence !== undefined
|
71
|
+
? ExportPresenceModes.fromUserOption(options.importExportsPresence)
|
72
|
+
: options.exportsPresence !== undefined
|
73
|
+
? ExportPresenceModes.fromUserOption(options.exportsPresence)
|
74
|
+
: options.strictExportPresence
|
75
|
+
? ExportPresenceModes.ERROR
|
76
|
+
: ExportPresenceModes.AUTO;
|
65
77
|
this.strictThisContextOnImports = options.strictThisContextOnImports;
|
66
78
|
}
|
67
79
|
|
@@ -70,6 +82,7 @@ module.exports = class HarmonyImportDependencyParserPlugin {
|
|
70
82
|
* @returns {void}
|
71
83
|
*/
|
72
84
|
apply(parser) {
|
85
|
+
const { exportPresenceMode } = this;
|
73
86
|
parser.hooks.isPure
|
74
87
|
.for("Identifier")
|
75
88
|
.tap("HarmonyImportDependencyParserPlugin", expression => {
|
@@ -128,7 +141,7 @@ module.exports = class HarmonyImportDependencyParserPlugin {
|
|
128
141
|
settings.ids,
|
129
142
|
settings.name,
|
130
143
|
expr.range,
|
131
|
-
|
144
|
+
exportPresenceMode,
|
132
145
|
settings.assertions
|
133
146
|
);
|
134
147
|
dep.shorthand = parser.scope.inShorthand;
|
@@ -150,7 +163,7 @@ module.exports = class HarmonyImportDependencyParserPlugin {
|
|
150
163
|
ids,
|
151
164
|
settings.name,
|
152
165
|
expr.range,
|
153
|
-
|
166
|
+
exportPresenceMode,
|
154
167
|
settings.assertions
|
155
168
|
);
|
156
169
|
dep.asiSafe = !parser.isAsiPosition(expr.range[0]);
|
@@ -171,7 +184,7 @@ module.exports = class HarmonyImportDependencyParserPlugin {
|
|
171
184
|
ids,
|
172
185
|
settings.name,
|
173
186
|
callee.range,
|
174
|
-
|
187
|
+
exportPresenceMode,
|
175
188
|
settings.assertions
|
176
189
|
);
|
177
190
|
dep.directImport = members.length === 0;
|
@@ -28,6 +28,8 @@ const HarmonyImportDependency = require("./HarmonyImportDependency");
|
|
28
28
|
|
29
29
|
const idsSymbol = Symbol("HarmonyImportSpecifierDependency.ids");
|
30
30
|
|
31
|
+
const { ExportPresenceModes } = HarmonyImportDependency;
|
32
|
+
|
31
33
|
class HarmonyImportSpecifierDependency extends HarmonyImportDependency {
|
32
34
|
constructor(
|
33
35
|
request,
|
@@ -35,14 +37,14 @@ class HarmonyImportSpecifierDependency extends HarmonyImportDependency {
|
|
35
37
|
ids,
|
36
38
|
name,
|
37
39
|
range,
|
38
|
-
|
40
|
+
exportPresenceMode,
|
39
41
|
assertions
|
40
42
|
) {
|
41
43
|
super(request, sourceOrder, assertions);
|
42
44
|
this.ids = ids;
|
43
45
|
this.name = name;
|
44
46
|
this.range = range;
|
45
|
-
this.
|
47
|
+
this.exportPresenceMode = exportPresenceMode;
|
46
48
|
this.namespaceObjectAsContext = false;
|
47
49
|
this.call = undefined;
|
48
50
|
this.directImport = undefined;
|
@@ -153,19 +155,29 @@ class HarmonyImportSpecifierDependency extends HarmonyImportDependency {
|
|
153
155
|
return [ids];
|
154
156
|
}
|
155
157
|
|
158
|
+
/**
|
159
|
+
* @param {ModuleGraph} moduleGraph module graph
|
160
|
+
* @returns {number} effective mode
|
161
|
+
*/
|
162
|
+
_getEffectiveExportPresenceLevel(moduleGraph) {
|
163
|
+
if (this.exportPresenceMode !== ExportPresenceModes.AUTO)
|
164
|
+
return this.exportPresenceMode;
|
165
|
+
return moduleGraph.getParentModule(this).buildMeta.strictHarmonyModule
|
166
|
+
? ExportPresenceModes.ERROR
|
167
|
+
: ExportPresenceModes.WARN;
|
168
|
+
}
|
169
|
+
|
156
170
|
/**
|
157
171
|
* Returns warnings
|
158
172
|
* @param {ModuleGraph} moduleGraph module graph
|
159
173
|
* @returns {WebpackError[]} warnings
|
160
174
|
*/
|
161
175
|
getWarnings(moduleGraph) {
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
) {
|
166
|
-
return null;
|
176
|
+
const exportsPresence = this._getEffectiveExportPresenceLevel(moduleGraph);
|
177
|
+
if (exportsPresence === ExportPresenceModes.WARN) {
|
178
|
+
return this._getErrors(moduleGraph);
|
167
179
|
}
|
168
|
-
return
|
180
|
+
return null;
|
169
181
|
}
|
170
182
|
|
171
183
|
/**
|
@@ -174,10 +186,8 @@ class HarmonyImportSpecifierDependency extends HarmonyImportDependency {
|
|
174
186
|
* @returns {WebpackError[]} errors
|
175
187
|
*/
|
176
188
|
getErrors(moduleGraph) {
|
177
|
-
|
178
|
-
|
179
|
-
moduleGraph.getParentModule(this).buildMeta.strictHarmonyModule
|
180
|
-
) {
|
189
|
+
const exportsPresence = this._getEffectiveExportPresenceLevel(moduleGraph);
|
190
|
+
if (exportsPresence === ExportPresenceModes.ERROR) {
|
181
191
|
return this._getErrors(moduleGraph);
|
182
192
|
}
|
183
193
|
return null;
|
@@ -209,7 +219,7 @@ class HarmonyImportSpecifierDependency extends HarmonyImportDependency {
|
|
209
219
|
write(this.ids);
|
210
220
|
write(this.name);
|
211
221
|
write(this.range);
|
212
|
-
write(this.
|
222
|
+
write(this.exportPresenceMode);
|
213
223
|
write(this.namespaceObjectAsContext);
|
214
224
|
write(this.call);
|
215
225
|
write(this.directImport);
|
@@ -224,7 +234,7 @@ class HarmonyImportSpecifierDependency extends HarmonyImportDependency {
|
|
224
234
|
this.ids = read();
|
225
235
|
this.name = read();
|
226
236
|
this.range = read();
|
227
|
-
this.
|
237
|
+
this.exportPresenceMode = read();
|
228
238
|
this.namespaceObjectAsContext = read();
|
229
239
|
this.call = read();
|
230
240
|
this.directImport = read();
|
@@ -85,14 +85,14 @@ RequireEnsureDependency.Template = class RequireEnsureDependencyTemplate extends
|
|
85
85
|
source.replace(
|
86
86
|
contentRange[1],
|
87
87
|
errorHandlerRange[0] - 1,
|
88
|
-
").bind(null, __webpack_require__))
|
88
|
+
").bind(null, __webpack_require__))['catch']("
|
89
89
|
);
|
90
90
|
source.replace(errorHandlerRange[1], range[1] - 1, ")");
|
91
91
|
} else {
|
92
92
|
source.replace(
|
93
93
|
contentRange[1],
|
94
94
|
range[1] - 1,
|
95
|
-
`).bind(null, __webpack_require__))
|
95
|
+
`).bind(null, __webpack_require__))['catch'](${RuntimeGlobals.uncaughtErrorHandler})`
|
96
96
|
);
|
97
97
|
}
|
98
98
|
}
|
@@ -41,7 +41,12 @@ module.exports = options => (compiler, callback) => {
|
|
41
41
|
const listen =
|
42
42
|
typeof options.listen === "function"
|
43
43
|
? options.listen
|
44
|
-
: server =>
|
44
|
+
: server => {
|
45
|
+
let listen = options.listen;
|
46
|
+
if (typeof listen === "object" && !("port" in listen))
|
47
|
+
listen = { ...listen, port: undefined };
|
48
|
+
server.listen(listen);
|
49
|
+
};
|
45
50
|
|
46
51
|
const protocol = options.protocol || (isHttps ? "https" : "http");
|
47
52
|
|
@@ -211,7 +211,7 @@ class RequireChunkLoadingRuntimeModule extends RuntimeModule {
|
|
211
211
|
RuntimeGlobals.getUpdateManifestFilename
|
212
212
|
}());`
|
213
213
|
]),
|
214
|
-
|
214
|
+
"})['catch'](function(err) { if(err.code !== 'MODULE_NOT_FOUND') throw err; });"
|
215
215
|
]),
|
216
216
|
"}"
|
217
217
|
])
|
@@ -56,6 +56,7 @@ class ModuleConcatenationPlugin {
|
|
56
56
|
* @returns {void}
|
57
57
|
*/
|
58
58
|
apply(compiler) {
|
59
|
+
const { _backCompat: backCompat } = compiler;
|
59
60
|
compiler.hooks.compilation.tap("ModuleConcatenationPlugin", compilation => {
|
60
61
|
const moduleGraph = compilation.moduleGraph;
|
61
62
|
const bailoutReasonMap = new Map();
|
@@ -389,8 +390,10 @@ class ModuleConcatenationPlugin {
|
|
389
390
|
};
|
390
391
|
|
391
392
|
const integrate = () => {
|
392
|
-
|
393
|
-
|
393
|
+
if (backCompat) {
|
394
|
+
ChunkGraph.setChunkGraphForModule(newModule, chunkGraph);
|
395
|
+
ModuleGraph.setModuleGraphForModule(newModule, moduleGraph);
|
396
|
+
}
|
394
397
|
|
395
398
|
for (const warning of concatConfiguration.getWarningsSorted()) {
|
396
399
|
moduleGraph
|
@@ -102,6 +102,7 @@ const MinMaxSizeWarning = require("./MinMaxSizeWarning");
|
|
102
102
|
|
103
103
|
/**
|
104
104
|
* @typedef {Object} FallbackCacheGroup
|
105
|
+
* @property {ChunkFilterFunction} chunksFilter
|
105
106
|
* @property {SplitChunksSizes} minSize
|
106
107
|
* @property {SplitChunksSizes} maxAsyncSize
|
107
108
|
* @property {SplitChunksSizes} maxInitialSize
|
@@ -658,6 +659,9 @@ module.exports = class SplitChunksPlugin {
|
|
658
659
|
automaticNameDelimiter: options.automaticNameDelimiter,
|
659
660
|
usedExports: options.usedExports,
|
660
661
|
fallbackCacheGroup: {
|
662
|
+
chunksFilter: normalizeChunksFilter(
|
663
|
+
fallbackCacheGroup.chunks || options.chunks || "all"
|
664
|
+
),
|
661
665
|
minSize: mergeSizes(
|
662
666
|
normalizeSizes(fallbackCacheGroup.minSize, defaultSizeTypes),
|
663
667
|
minSize
|
@@ -1598,6 +1602,7 @@ module.exports = class SplitChunksPlugin {
|
|
1598
1602
|
const { outputOptions } = compilation;
|
1599
1603
|
|
1600
1604
|
// Make sure that maxSize is fulfilled
|
1605
|
+
const { fallbackCacheGroup } = this.options;
|
1601
1606
|
for (const chunk of Array.from(compilation.chunks)) {
|
1602
1607
|
const chunkConfig = maxSizeQueueMap.get(chunk);
|
1603
1608
|
const {
|
@@ -1605,7 +1610,9 @@ module.exports = class SplitChunksPlugin {
|
|
1605
1610
|
maxAsyncSize,
|
1606
1611
|
maxInitialSize,
|
1607
1612
|
automaticNameDelimiter
|
1608
|
-
} = chunkConfig ||
|
1613
|
+
} = chunkConfig || fallbackCacheGroup;
|
1614
|
+
if (!chunkConfig && !fallbackCacheGroup.chunksFilter(chunk))
|
1615
|
+
continue;
|
1609
1616
|
/** @type {SplitChunksSizes} */
|
1610
1617
|
let maxSize;
|
1611
1618
|
if (chunk.isOnlyInitial()) {
|
@@ -59,7 +59,7 @@ class AsyncModuleRuntimeModule extends HelperRuntimeModule {
|
|
59
59
|
])});`,
|
60
60
|
`var obj = {};
|
61
61
|
obj[webpackThen] = ${runtimeTemplate.expressionFunction(
|
62
|
-
"queueFunction(queue, fn), dep
|
62
|
+
"queueFunction(queue, fn), dep['catch'](reject)",
|
63
63
|
"fn, reject"
|
64
64
|
)};`,
|
65
65
|
"return obj;"
|
@@ -114,7 +114,7 @@ class AsyncModuleRuntimeModule extends HelperRuntimeModule {
|
|
114
114
|
"if (isEvaluating) { return completeFunction(fn); }",
|
115
115
|
"if (currentDeps) whenAll(currentDeps, fn, rejectFn);",
|
116
116
|
"queueFunction(queue, fn);",
|
117
|
-
"promise
|
117
|
+
"promise['catch'](rejectFn);"
|
118
118
|
]
|
119
119
|
)};`,
|
120
120
|
"module.exports = promise;",
|
@@ -320,7 +320,7 @@ class ConsumeSharedRuntimeModule extends RuntimeModule {
|
|
320
320
|
"var promise = moduleToHandlerMapping[id]();",
|
321
321
|
"if(promise.then) {",
|
322
322
|
Template.indent(
|
323
|
-
|
323
|
+
"promises.push(installedModules[id] = promise.then(onFactory)['catch'](onError));"
|
324
324
|
),
|
325
325
|
"} else onFactory(promise);"
|
326
326
|
]),
|
@@ -105,7 +105,7 @@ class ShareRuntimeModule extends RuntimeModule {
|
|
105
105
|
)}`,
|
106
106
|
"if(module.then) return promises.push(module.then(initFn, handleError));",
|
107
107
|
"var initResult = initFn(module);",
|
108
|
-
"if(initResult && initResult.then) return promises.push(initResult
|
108
|
+
"if(initResult && initResult.then) return promises.push(initResult['catch'](handleError));"
|
109
109
|
]),
|
110
110
|
"} catch(err) { handleError(err); }"
|
111
111
|
])}`,
|
@@ -1160,7 +1160,7 @@ const AVAILABLE_FORMATS = {
|
|
1160
1160
|
},
|
1161
1161
|
{ regExp: /(\(module has no exports\))/g, format: red },
|
1162
1162
|
{ regExp: /\(possible exports: (.+)\)/g, format: green },
|
1163
|
-
{ regExp: /\s*(
|
1163
|
+
{ regExp: /\s*([^\s].* doesn't exist)/g, format: red },
|
1164
1164
|
{ regExp: /('\w+' option has not been set)/g, format: red },
|
1165
1165
|
{
|
1166
1166
|
regExp: /(Emitted value instead of an instance of Error)/g,
|
package/lib/util/deprecation.js
CHANGED
@@ -165,8 +165,16 @@ exports.arrayToSetDeprecation = (set, name) => {
|
|
165
165
|
};
|
166
166
|
|
167
167
|
exports.createArrayToSetDeprecationSet = name => {
|
168
|
-
|
169
|
-
|
168
|
+
let initialized = false;
|
169
|
+
class SetDeprecatedArray extends Set {
|
170
|
+
constructor(items) {
|
171
|
+
super(items);
|
172
|
+
if (!initialized) {
|
173
|
+
initialized = true;
|
174
|
+
exports.arrayToSetDeprecation(SetDeprecatedArray.prototype, name);
|
175
|
+
}
|
176
|
+
}
|
177
|
+
}
|
170
178
|
return SetDeprecatedArray;
|
171
179
|
};
|
172
180
|
|
@@ -36,7 +36,11 @@ class BatchedHash extends Hash {
|
|
36
36
|
this.string = undefined;
|
37
37
|
}
|
38
38
|
if (typeof data === "string") {
|
39
|
-
if (
|
39
|
+
if (
|
40
|
+
data.length < MAX_SHORT_STRING &&
|
41
|
+
// base64 encoding is not valid since it may contain padding chars
|
42
|
+
(!inputEncoding || !inputEncoding.startsWith("ba"))
|
43
|
+
) {
|
40
44
|
this.string = data;
|
41
45
|
this.encoding = inputEncoding;
|
42
46
|
} else {
|
package/lib/webpack.js
CHANGED
@@ -61,8 +61,7 @@ const createMultiCompiler = (childOptions, options) => {
|
|
61
61
|
const createCompiler = rawOptions => {
|
62
62
|
const options = getNormalizedWebpackOptions(rawOptions);
|
63
63
|
applyWebpackOptionsBaseDefaults(options);
|
64
|
-
const compiler = new Compiler(options.context);
|
65
|
-
compiler.options = options;
|
64
|
+
const compiler = new Compiler(options.context, options);
|
66
65
|
new NodeEnvironmentPlugin({
|
67
66
|
infrastructureLogging: options.infrastructureLogging
|
68
67
|
}).apply(compiler);
|