webpack 5.64.4 → 5.65.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/ExternalModule.js +1 -1
- package/lib/RuntimeTemplate.js +92 -2
- package/lib/asset/AssetGenerator.js +7 -6
- package/lib/config/browserslistTargetHandler.js +38 -1
- package/lib/config/defaults.js +1 -1
- package/lib/config/target.js +10 -0
- package/lib/container/ContainerEntryModule.js +1 -3
- package/lib/index.js +3 -0
- package/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js +2 -2
- package/lib/javascript/JavascriptParser.js +7 -0
- package/lib/library/AssignLibraryPlugin.js +5 -10
- package/lib/sharing/ConsumeSharedModule.js +4 -0
- package/lib/sharing/ConsumeSharedRuntimeModule.js +21 -0
- package/lib/stats/DefaultStatsPrinterPlugin.js +1 -1
- package/lib/util/extractUrlAndGlobal.js +3 -0
- package/lib/web/JsonpChunkLoadingRuntimeModule.js +1 -1
- package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +2 -1
- package/package.json +2 -2
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +8 -0
- package/types.d.ts +35 -19
package/lib/ExternalModule.js
CHANGED
package/lib/RuntimeTemplate.js
CHANGED
@@ -50,6 +50,27 @@ Module has these incoming connections: ${Array.from(
|
|
50
50
|
).join("")}`;
|
51
51
|
};
|
52
52
|
|
53
|
+
/**
|
54
|
+
* @param {string|undefined} definition global object definition
|
55
|
+
* @returns {string} save to use global object
|
56
|
+
*/
|
57
|
+
function getGlobalObject(definition) {
|
58
|
+
if (!definition) return definition;
|
59
|
+
const trimmed = definition.trim();
|
60
|
+
|
61
|
+
if (
|
62
|
+
// identifier, we do not need real identifier regarding ECMAScript/Unicode
|
63
|
+
trimmed.match(/^[_\p{L}][_0-9\p{L}]*$/iu) ||
|
64
|
+
// iife
|
65
|
+
// call expression
|
66
|
+
// expression in parentheses
|
67
|
+
trimmed.match(/^([_\p{L}][_0-9\p{L}]*)?\(.*\)$/iu)
|
68
|
+
)
|
69
|
+
return trimmed;
|
70
|
+
|
71
|
+
return `Object(${trimmed})`;
|
72
|
+
}
|
73
|
+
|
53
74
|
class RuntimeTemplate {
|
54
75
|
/**
|
55
76
|
* @param {Compilation} compilation the compilation
|
@@ -60,6 +81,7 @@ class RuntimeTemplate {
|
|
60
81
|
this.compilation = compilation;
|
61
82
|
this.outputOptions = outputOptions || {};
|
62
83
|
this.requestShortener = requestShortener;
|
84
|
+
this.globalObject = getGlobalObject(outputOptions.globalObject);
|
63
85
|
}
|
64
86
|
|
65
87
|
isIIFE() {
|
@@ -78,6 +100,10 @@ class RuntimeTemplate {
|
|
78
100
|
return this.outputOptions.environment.arrowFunction;
|
79
101
|
}
|
80
102
|
|
103
|
+
supportsOptionalChaining() {
|
104
|
+
return this.outputOptions.environment.optionalChaining;
|
105
|
+
}
|
106
|
+
|
81
107
|
supportsForOf() {
|
82
108
|
return this.outputOptions.environment.forOf;
|
83
109
|
}
|
@@ -99,8 +125,7 @@ class RuntimeTemplate {
|
|
99
125
|
}
|
100
126
|
|
101
127
|
supportTemplateLiteral() {
|
102
|
-
|
103
|
-
return false;
|
128
|
+
return this.outputOptions.environment.templateLiteral;
|
104
129
|
}
|
105
130
|
|
106
131
|
returningFunction(returnValue, args = "") {
|
@@ -115,6 +140,71 @@ class RuntimeTemplate {
|
|
115
140
|
: `function(${args}) {\n${Template.indent(body)}\n}`;
|
116
141
|
}
|
117
142
|
|
143
|
+
/**
|
144
|
+
* @param {Array<string|{expr: string}>} args args
|
145
|
+
* @returns {string} result expression
|
146
|
+
*/
|
147
|
+
concatenation(...args) {
|
148
|
+
const len = args.length;
|
149
|
+
|
150
|
+
if (len === 2) return this._es5Concatenation(args);
|
151
|
+
if (len === 0) return '""';
|
152
|
+
if (len === 1) {
|
153
|
+
return typeof args[0] === "string"
|
154
|
+
? JSON.stringify(args[0])
|
155
|
+
: `"" + ${args[0].expr}`;
|
156
|
+
}
|
157
|
+
if (!this.supportTemplateLiteral()) return this._es5Concatenation(args);
|
158
|
+
|
159
|
+
// cost comparison between template literal and concatenation:
|
160
|
+
// both need equal surroundings: `xxx` vs "xxx"
|
161
|
+
// template literal has constant cost of 3 chars for each expression
|
162
|
+
// es5 concatenation has cost of 3 + n chars for n expressions in row
|
163
|
+
// when a es5 concatenation ends with an expression it reduces cost by 3
|
164
|
+
// when a es5 concatenation starts with an single expression it reduces cost by 3
|
165
|
+
// e. g. `${a}${b}${c}` (3*3 = 9) is longer than ""+a+b+c ((3+3)-3 = 3)
|
166
|
+
// e. g. `x${a}x${b}x${c}x` (3*3 = 9) is shorter than "x"+a+"x"+b+"x"+c+"x" (4+4+4 = 12)
|
167
|
+
|
168
|
+
let templateCost = 0;
|
169
|
+
let concatenationCost = 0;
|
170
|
+
|
171
|
+
let lastWasExpr = false;
|
172
|
+
for (const arg of args) {
|
173
|
+
const isExpr = typeof arg !== "string";
|
174
|
+
if (isExpr) {
|
175
|
+
templateCost += 3;
|
176
|
+
concatenationCost += lastWasExpr ? 1 : 4;
|
177
|
+
}
|
178
|
+
lastWasExpr = isExpr;
|
179
|
+
}
|
180
|
+
if (lastWasExpr) concatenationCost -= 3;
|
181
|
+
if (typeof args[0] !== "string" && typeof args[1] === "string")
|
182
|
+
concatenationCost -= 3;
|
183
|
+
|
184
|
+
if (concatenationCost <= templateCost) return this._es5Concatenation(args);
|
185
|
+
|
186
|
+
return `\`${args
|
187
|
+
.map(arg => (typeof arg === "string" ? arg : `\${${arg.expr}}`))
|
188
|
+
.join("")}\``;
|
189
|
+
}
|
190
|
+
|
191
|
+
/**
|
192
|
+
* @param {Array<string|{expr: string}>} args args (len >= 2)
|
193
|
+
* @returns {string} result expression
|
194
|
+
* @private
|
195
|
+
*/
|
196
|
+
_es5Concatenation(args) {
|
197
|
+
const str = args
|
198
|
+
.map(arg => (typeof arg === "string" ? JSON.stringify(arg) : arg.expr))
|
199
|
+
.join(" + ");
|
200
|
+
|
201
|
+
// when the first two args are expression, we need to prepend "" + to force string
|
202
|
+
// concatenation instead of number addition.
|
203
|
+
return typeof args[0] !== "string" && typeof args[1] !== "string"
|
204
|
+
? `"" + ${str}`
|
205
|
+
: str;
|
206
|
+
}
|
207
|
+
|
118
208
|
expressionFunction(expression, args = "") {
|
119
209
|
return this.supportsArrowFunction()
|
120
210
|
? `(${args}) => (${expression})`
|
@@ -228,7 +228,7 @@ class AssetGenerator extends Generator {
|
|
228
228
|
contentHash
|
229
229
|
}
|
230
230
|
);
|
231
|
-
let
|
231
|
+
let assetPath;
|
232
232
|
if (this.publicPath !== undefined) {
|
233
233
|
const { path, info } =
|
234
234
|
runtimeTemplate.compilation.getAssetPathWithInfo(
|
@@ -241,11 +241,14 @@ class AssetGenerator extends Generator {
|
|
241
241
|
contentHash
|
242
242
|
}
|
243
243
|
);
|
244
|
-
publicPath = JSON.stringify(path);
|
245
244
|
assetInfo = mergeAssetInfo(assetInfo, info);
|
245
|
+
assetPath = JSON.stringify(path + filename);
|
246
246
|
} else {
|
247
|
-
publicPath = RuntimeGlobals.publicPath;
|
248
247
|
runtimeRequirements.add(RuntimeGlobals.publicPath); // add __webpack_require__.p
|
248
|
+
assetPath = runtimeTemplate.concatenation(
|
249
|
+
{ expr: RuntimeGlobals.publicPath },
|
250
|
+
filename
|
251
|
+
);
|
249
252
|
}
|
250
253
|
assetInfo = {
|
251
254
|
sourceFilename,
|
@@ -264,9 +267,7 @@ class AssetGenerator extends Generator {
|
|
264
267
|
}
|
265
268
|
|
266
269
|
return new RawSource(
|
267
|
-
`${
|
268
|
-
RuntimeGlobals.module
|
269
|
-
}.exports = ${publicPath} + ${JSON.stringify(filename)};`
|
270
|
+
`${RuntimeGlobals.module}.exports = ${assetPath};`
|
270
271
|
);
|
271
272
|
}
|
272
273
|
}
|
@@ -274,7 +274,44 @@ const resolve = browsers => {
|
|
274
274
|
// kaios: Unknown support
|
275
275
|
node: [12, 0]
|
276
276
|
}),
|
277
|
-
|
277
|
+
optionalChaining: rawChecker({
|
278
|
+
chrome: 80,
|
279
|
+
and_chr: 80,
|
280
|
+
edge: 80,
|
281
|
+
firefox: 74,
|
282
|
+
and_ff: 79,
|
283
|
+
// ie: Not supported,
|
284
|
+
opera: 67,
|
285
|
+
op_mob: 64,
|
286
|
+
safari: [13, 1],
|
287
|
+
ios_saf: [13, 4],
|
288
|
+
samsung: 13,
|
289
|
+
android: 80,
|
290
|
+
// and_qq: Not supported
|
291
|
+
// baidu: Not supported
|
292
|
+
// and_uc: Not supported
|
293
|
+
// kaios: Not supported
|
294
|
+
node: 14
|
295
|
+
}),
|
296
|
+
templateLiteral: rawChecker({
|
297
|
+
chrome: 41,
|
298
|
+
and_chr: 41,
|
299
|
+
edge: 13,
|
300
|
+
firefox: 34,
|
301
|
+
and_ff: 34,
|
302
|
+
// ie: Not supported,
|
303
|
+
opera: 29,
|
304
|
+
op_mob: 64,
|
305
|
+
safari: [9, 1],
|
306
|
+
ios_saf: 9,
|
307
|
+
samsung: 4,
|
308
|
+
android: 41,
|
309
|
+
and_qq: [10, 4],
|
310
|
+
baidu: [7, 12],
|
311
|
+
and_uc: [12, 12],
|
312
|
+
kaios: [2, 5],
|
313
|
+
node: 4
|
314
|
+
}),
|
278
315
|
browser: browserProperty,
|
279
316
|
electron: false,
|
280
317
|
node: nodeProperty,
|
package/lib/config/defaults.js
CHANGED
@@ -832,7 +832,7 @@ const applyOutputDefaults = (
|
|
832
832
|
D(output, "chunkLoadTimeout", 120000);
|
833
833
|
D(output, "hashFunction", futureDefaults ? "xxhash64" : "md4");
|
834
834
|
D(output, "hashDigest", "hex");
|
835
|
-
D(output, "hashDigestLength", 20);
|
835
|
+
D(output, "hashDigestLength", futureDefaults ? 16 : 20);
|
836
836
|
D(output, "strictModuleExceptionHandling", false);
|
837
837
|
|
838
838
|
const optimistic = v => v || v === undefined;
|
package/lib/config/target.js
CHANGED
@@ -59,6 +59,8 @@ const getDefaultTarget = context => {
|
|
59
59
|
* @property {boolean | null} dynamicImport async import() is available
|
60
60
|
* @property {boolean | null} dynamicImportInWorker async import() is available when creating a worker
|
61
61
|
* @property {boolean | null} module ESM syntax is available (when in module)
|
62
|
+
* @property {boolean | null} optionalChaining optional chaining is available
|
63
|
+
* @property {boolean | null} templateLiteral template literal is available
|
62
64
|
*/
|
63
65
|
|
64
66
|
///** @typedef {PlatformTargetProperties | ApiTargetProperties | EcmaTargetProperties | PlatformTargetProperties & ApiTargetProperties | PlatformTargetProperties & EcmaTargetProperties | ApiTargetProperties & EcmaTargetProperties} TargetProperties */
|
@@ -167,6 +169,8 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
167
169
|
|
168
170
|
globalThis: v(12),
|
169
171
|
const: v(6),
|
172
|
+
templateLiteral: v(4),
|
173
|
+
optionalChaining: v(14),
|
170
174
|
arrowFunction: v(6),
|
171
175
|
forOf: v(5),
|
172
176
|
destructuring: v(6),
|
@@ -206,6 +210,8 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
206
210
|
|
207
211
|
globalThis: v(5),
|
208
212
|
const: v(1, 1),
|
213
|
+
templateLiteral: v(1, 1),
|
214
|
+
optionalChaining: v(8),
|
209
215
|
arrowFunction: v(1, 1),
|
210
216
|
forOf: v(0, 36),
|
211
217
|
destructuring: v(1, 1),
|
@@ -241,6 +247,8 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
241
247
|
|
242
248
|
globalThis: v(0, 43),
|
243
249
|
const: v(0, 15),
|
250
|
+
templateLiteral: v(0, 13),
|
251
|
+
optionalChaining: v(0, 44),
|
244
252
|
arrowFunction: v(0, 15),
|
245
253
|
forOf: v(0, 13),
|
246
254
|
destructuring: v(0, 15),
|
@@ -260,6 +268,8 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
260
268
|
if (v < 1000) v = v + 2009;
|
261
269
|
return {
|
262
270
|
const: v >= 2015,
|
271
|
+
templateLiteral: v >= 2015,
|
272
|
+
optionalChaining: v >= 2020,
|
263
273
|
arrowFunction: v >= 2015,
|
264
274
|
forOf: v >= 2015,
|
265
275
|
destructuring: v >= 2015,
|
@@ -220,10 +220,8 @@ class ContainerEntryModule extends Module {
|
|
220
220
|
])};`,
|
221
221
|
`var init = ${runtimeTemplate.basicFunction("shareScope, initScope", [
|
222
222
|
`if (!${RuntimeGlobals.shareScopeMap}) return;`,
|
223
|
-
`var oldScope = ${RuntimeGlobals.shareScopeMap}[${JSON.stringify(
|
224
|
-
this._shareScope
|
225
|
-
)}];`,
|
226
223
|
`var name = ${JSON.stringify(this._shareScope)}`,
|
224
|
+
`var oldScope = ${RuntimeGlobals.shareScopeMap}[name];`,
|
227
225
|
`if(oldScope && oldScope !== shareScope) throw new Error("Container initialization failed as it has already been initialized with a different share scope");`,
|
228
226
|
`${RuntimeGlobals.shareScopeMap}[name] = shareScope;`,
|
229
227
|
`return ${RuntimeGlobals.initializeSharing}(name, initScope);`
|
package/lib/index.js
CHANGED
@@ -19,6 +19,7 @@ const memoize = require("./util/memoize");
|
|
19
19
|
/** @typedef {import("../declarations/WebpackOptions").RuleSetRule} RuleSetRule */
|
20
20
|
/** @typedef {import("../declarations/WebpackOptions").RuleSetUse} RuleSetUse */
|
21
21
|
/** @typedef {import("../declarations/WebpackOptions").RuleSetUseItem} RuleSetUseItem */
|
22
|
+
/** @typedef {import("../declarations/WebpackOptions").StatsOptions} StatsOptions */
|
22
23
|
/** @typedef {import("../declarations/WebpackOptions").WebpackOptions} Configuration */
|
23
24
|
/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptionsNormalized */
|
24
25
|
/** @typedef {import("../declarations/WebpackOptions").WebpackPluginFunction} WebpackPluginFunction */
|
@@ -27,6 +28,8 @@ const memoize = require("./util/memoize");
|
|
27
28
|
/** @typedef {import("./Compilation").AssetInfo} AssetInfo */
|
28
29
|
/** @typedef {import("./MultiStats")} MultiStats */
|
29
30
|
/** @typedef {import("./Parser").ParserState} ParserState */
|
31
|
+
/** @typedef {import("./ResolverFactory").ResolvePluginInstance} ResolvePluginInstance */
|
32
|
+
/** @typedef {import("./ResolverFactory").Resolver} Resolver */
|
30
33
|
/** @typedef {import("./Watching")} Watching */
|
31
34
|
/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsAsset} StatsAsset */
|
32
35
|
/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsChunk} StatsChunk */
|
@@ -45,7 +45,7 @@ class ArrayPushCallbackChunkFormatPlugin {
|
|
45
45
|
const { chunk, chunkGraph, runtimeTemplate } = renderContext;
|
46
46
|
const hotUpdateChunk =
|
47
47
|
chunk instanceof HotUpdateChunk ? chunk : null;
|
48
|
-
const globalObject = runtimeTemplate.
|
48
|
+
const globalObject = runtimeTemplate.globalObject;
|
49
49
|
const source = new ConcatSource();
|
50
50
|
const runtimeModules =
|
51
51
|
chunkGraph.getChunkRuntimeModulesInOrder(chunk);
|
@@ -138,7 +138,7 @@ class ArrayPushCallbackChunkFormatPlugin {
|
|
138
138
|
(chunk, hash, { chunkGraph, runtimeTemplate }) => {
|
139
139
|
if (chunk.hasRuntime()) return;
|
140
140
|
hash.update(
|
141
|
-
`ArrayPushCallbackChunkFormatPlugin1${runtimeTemplate.outputOptions.chunkLoadingGlobal}${runtimeTemplate.outputOptions.hotUpdateGlobal}${runtimeTemplate.
|
141
|
+
`ArrayPushCallbackChunkFormatPlugin1${runtimeTemplate.outputOptions.chunkLoadingGlobal}${runtimeTemplate.outputOptions.hotUpdateGlobal}${runtimeTemplate.globalObject}`
|
142
142
|
);
|
143
143
|
const entries = Array.from(
|
144
144
|
chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk)
|
@@ -935,6 +935,13 @@ class JavascriptParser extends Parser {
|
|
935
935
|
.setString("undefined")
|
936
936
|
.setRange(expr.range);
|
937
937
|
});
|
938
|
+
this.hooks.evaluate.for("Identifier").tap("JavascriptParser", expr => {
|
939
|
+
if (/** @type {IdentifierNode} */ (expr).name === "undefined") {
|
940
|
+
return new BasicEvaluatedExpression()
|
941
|
+
.setUndefined()
|
942
|
+
.setRange(expr.range);
|
943
|
+
}
|
944
|
+
});
|
938
945
|
/**
|
939
946
|
* @param {string} exprType expression type name
|
940
947
|
* @param {function(ExpressionNode): GetInfoResult | undefined} getInfo get info
|
@@ -174,7 +174,7 @@ class AssignLibraryPlugin extends AbstractLibraryPlugin {
|
|
174
174
|
|
175
175
|
_getPrefix(compilation) {
|
176
176
|
return this.prefix === "global"
|
177
|
-
? [compilation.
|
177
|
+
? [compilation.runtimeTemplate.globalObject]
|
178
178
|
: this.prefix;
|
179
179
|
}
|
180
180
|
|
@@ -325,15 +325,10 @@ class AssignLibraryPlugin extends AbstractLibraryPlugin {
|
|
325
325
|
*/
|
326
326
|
chunkHash(chunk, hash, chunkHashContext, { options, compilation }) {
|
327
327
|
hash.update("AssignLibraryPlugin");
|
328
|
-
const
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
const fullName = options.name ? prefix.concat(options.name) : prefix;
|
333
|
-
const fullNameResolved = fullName.map(n =>
|
334
|
-
compilation.getPath(n, {
|
335
|
-
chunk
|
336
|
-
})
|
328
|
+
const fullNameResolved = this._getResolvedFullName(
|
329
|
+
options,
|
330
|
+
chunk,
|
331
|
+
compilation
|
337
332
|
);
|
338
333
|
if (options.name ? this.named === "copy" : this.unnamed === "copy") {
|
339
334
|
hash.update("copy");
|
@@ -108,6 +108,13 @@ class ConsumeSharedRuntimeModule extends RuntimeModule {
|
|
108
108
|
`return "Unsatisfied version " + version + " from " + (version && scope[key][version].from) + " of shared singleton module " + key + " (required " + rangeToString(requiredVersion) + ")"`
|
109
109
|
]
|
110
110
|
)};`,
|
111
|
+
`var getSingleton = ${runtimeTemplate.basicFunction(
|
112
|
+
"scope, scopeName, key, requiredVersion",
|
113
|
+
[
|
114
|
+
"var version = findSingletonVersionKey(scope, key);",
|
115
|
+
"return get(scope[key][version]);"
|
116
|
+
]
|
117
|
+
)};`,
|
111
118
|
`var getSingletonVersion = ${runtimeTemplate.basicFunction(
|
112
119
|
"scope, scopeName, key, requiredVersion",
|
113
120
|
[
|
@@ -202,6 +209,13 @@ class ConsumeSharedRuntimeModule extends RuntimeModule {
|
|
202
209
|
"return get(findValidVersion(scope, key, version) || warnInvalidVersion(scope, scopeName, key, version) || findVersion(scope, key));"
|
203
210
|
]
|
204
211
|
)});`,
|
212
|
+
`var loadSingleton = /*#__PURE__*/ init(${runtimeTemplate.basicFunction(
|
213
|
+
"scopeName, scope, key",
|
214
|
+
[
|
215
|
+
"ensureExistence(scopeName, key);",
|
216
|
+
"return getSingleton(scope, scopeName, key);"
|
217
|
+
]
|
218
|
+
)});`,
|
205
219
|
`var loadSingletonVersionCheck = /*#__PURE__*/ init(${runtimeTemplate.basicFunction(
|
206
220
|
"scopeName, scope, key, version",
|
207
221
|
[
|
@@ -230,6 +244,13 @@ class ConsumeSharedRuntimeModule extends RuntimeModule {
|
|
230
244
|
"return get(findValidVersion(scope, key, version) || warnInvalidVersion(scope, scopeName, key, version) || findVersion(scope, key));"
|
231
245
|
]
|
232
246
|
)});`,
|
247
|
+
`var loadSingletonFallback = /*#__PURE__*/ init(${runtimeTemplate.basicFunction(
|
248
|
+
"scopeName, scope, key, fallback",
|
249
|
+
[
|
250
|
+
`if(!scope || !${RuntimeGlobals.hasOwnProperty}(scope, key)) return fallback();`,
|
251
|
+
"return getSingleton(scope, scopeName, key);"
|
252
|
+
]
|
253
|
+
)});`,
|
233
254
|
`var loadSingletonVersionCheckFallback = /*#__PURE__*/ init(${runtimeTemplate.basicFunction(
|
234
255
|
"scopeName, scope, key, version, fallback",
|
235
256
|
[
|
@@ -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:
|
1163
|
+
{ regExp: /(?:^|\n)(.* 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,
|
@@ -11,5 +11,8 @@
|
|
11
11
|
*/
|
12
12
|
module.exports = function extractUrlAndGlobal(urlAndGlobal) {
|
13
13
|
const index = urlAndGlobal.indexOf("@");
|
14
|
+
if (index <= 0 || index === urlAndGlobal.length - 1) {
|
15
|
+
throw new Error(`Invalid request "${urlAndGlobal}"`);
|
16
|
+
}
|
14
17
|
return [urlAndGlobal.substring(index + 1), urlAndGlobal.substring(0, index)];
|
15
18
|
};
|
@@ -59,13 +59,13 @@ class JsonpChunkLoadingRuntimeModule extends RuntimeModule {
|
|
59
59
|
const {
|
60
60
|
runtimeTemplate,
|
61
61
|
outputOptions: {
|
62
|
-
globalObject,
|
63
62
|
chunkLoadingGlobal,
|
64
63
|
hotUpdateGlobal,
|
65
64
|
crossOriginLoading,
|
66
65
|
scriptType
|
67
66
|
}
|
68
67
|
} = compilation;
|
68
|
+
const globalObject = runtimeTemplate.globalObject;
|
69
69
|
const { linkPreload, linkPrefetch } =
|
70
70
|
JsonpChunkLoadingRuntimeModule.getCompilationHooks(compilation);
|
71
71
|
const fn = RuntimeGlobals.ensureChunkHandlers;
|
@@ -31,10 +31,11 @@ class ImportScriptsChunkLoadingRuntimeModule extends RuntimeModule {
|
|
31
31
|
chunkGraph,
|
32
32
|
compilation: {
|
33
33
|
runtimeTemplate,
|
34
|
-
outputOptions: {
|
34
|
+
outputOptions: { chunkLoadingGlobal, hotUpdateGlobal }
|
35
35
|
},
|
36
36
|
_withCreateScriptUrl: withCreateScriptUrl
|
37
37
|
} = this;
|
38
|
+
const globalObject = runtimeTemplate.globalObject;
|
38
39
|
const fn = RuntimeGlobals.ensureChunkHandlers;
|
39
40
|
const withBaseURI = this.runtimeRequirements.has(RuntimeGlobals.baseURI);
|
40
41
|
const withLoading = this.runtimeRequirements.has(
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "webpack",
|
3
|
-
"version": "5.
|
3
|
+
"version": "5.65.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",
|
@@ -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.
|
30
|
+
"watchpack": "^2.3.1",
|
31
31
|
"webpack-sources": "^3.2.2"
|
32
32
|
},
|
33
33
|
"peerDependenciesMeta": {
|