webpack 5.76.3 → 5.78.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 +0 -0
- package/lib/APIPlugin.js +25 -18
- package/lib/CompatibilityPlugin.js +53 -52
- package/lib/ConstPlugin.js +22 -15
- package/lib/ContextModule.js +3 -2
- package/lib/DefinePlugin.js +44 -36
- package/lib/DelegatedModule.js +2 -1
- package/lib/DllModule.js +2 -1
- package/lib/ErrorHelpers.js +61 -22
- package/lib/ExportsInfoApiPlugin.js +16 -9
- package/lib/ExternalModule.js +2 -1
- package/lib/FlagAllModulesAsUsedPlugin.js +22 -27
- package/lib/FlagDependencyExportsPlugin.js +336 -348
- package/lib/FlagDependencyUsagePlugin.js +6 -8
- package/lib/FlagEntryExportAsUsedPlugin.js +22 -23
- package/lib/HotModuleReplacementPlugin.js +50 -45
- package/lib/JavascriptMetaInfoPlugin.js +16 -9
- package/lib/ModuleTypeConstants.js +50 -0
- package/lib/NodeStuffPlugin.js +35 -31
- package/lib/NormalModule.js +2 -1
- package/lib/NormalModuleFactory.js +27 -1
- package/lib/ProvidePlugin.js +17 -10
- package/lib/RawModule.js +2 -1
- package/lib/RequireJsStuffPlugin.js +15 -15
- package/lib/UseStrictPlugin.js +15 -8
- package/lib/WebpackIsIncludedPlugin.js +16 -9
- package/lib/WebpackOptionsApply.js +2 -1
- package/lib/config/defaults.js +17 -8
- package/lib/config/normalization.js +5 -0
- package/lib/container/ContainerEntryModule.js +2 -1
- package/lib/css/CssParser.js +22 -2
- package/lib/debug/ProfilingPlugin.js +20 -12
- package/lib/dependencies/AMDPlugin.js +26 -20
- package/lib/dependencies/CommonJsImportsParserPlugin.js +5 -4
- package/lib/dependencies/CommonJsPlugin.js +29 -25
- package/lib/dependencies/HarmonyDetectionParserPlugin.js +3 -1
- package/lib/dependencies/HarmonyModulesPlugin.js +11 -5
- package/lib/dependencies/ImportMetaContextPlugin.js +11 -5
- package/lib/dependencies/ImportMetaPlugin.js +26 -20
- package/lib/dependencies/ImportPlugin.js +14 -7
- package/lib/dependencies/RequireContextPlugin.js +12 -6
- package/lib/dependencies/RequireEnsurePlugin.js +13 -7
- package/lib/dependencies/RequireIncludePlugin.js +11 -5
- package/lib/dependencies/SystemPlugin.js +21 -15
- package/lib/dependencies/URLPlugin.js +15 -9
- package/lib/dependencies/WorkerDependency.js +37 -2
- package/lib/dependencies/WorkerPlugin.js +19 -10
- package/lib/javascript/JavascriptModulesPlugin.js +157 -164
- package/lib/json/JsonModulesPlugin.js +13 -5
- package/lib/library/AmdLibraryPlugin.js +22 -6
- package/lib/node/ReadFileCompileAsyncWasmPlugin.js +2 -1
- package/lib/node/ReadFileCompileWasmPlugin.js +2 -1
- package/lib/optimize/ConcatenatedModule.js +2 -1
- package/lib/optimize/InnerGraphPlugin.js +47 -46
- package/lib/optimize/SideEffectsFlagPlugin.js +43 -43
- package/lib/sharing/ConsumeSharedPlugin.js +4 -0
- package/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js +9 -6
- package/lib/wasm-sync/WebAssemblyModulesPlugin.js +42 -43
- package/lib/web/FetchCompileAsyncWasmPlugin.js +2 -1
- package/lib/web/FetchCompileWasmPlugin.js +40 -40
- package/package.json +1 -1
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +28 -0
- package/schemas/plugins/container/ContainerPlugin.check.js +1 -1
- package/schemas/plugins/container/ContainerPlugin.json +8 -0
- package/schemas/plugins/container/ModuleFederationPlugin.check.js +1 -1
- package/schemas/plugins/container/ModuleFederationPlugin.json +8 -0
- package/types.d.ts +20 -0
@@ -18,6 +18,11 @@ const Compilation = require("../Compilation");
|
|
18
18
|
const { tryRunOrWebpackError } = require("../HookWebpackError");
|
19
19
|
const HotUpdateChunk = require("../HotUpdateChunk");
|
20
20
|
const InitFragment = require("../InitFragment");
|
21
|
+
const {
|
22
|
+
JAVASCRIPT_MODULE_TYPE_AUTO,
|
23
|
+
JAVASCRIPT_MODULE_TYPE_DYNAMIC,
|
24
|
+
JAVASCRIPT_MODULE_TYPE_ESM
|
25
|
+
} = require("../ModuleTypeConstants");
|
21
26
|
const RuntimeGlobals = require("../RuntimeGlobals");
|
22
27
|
const Template = require("../Template");
|
23
28
|
const { last, someInIterable } = require("../util/IterableHelpers");
|
@@ -133,6 +138,8 @@ const printGeneratedCodeForStack = (module, code) => {
|
|
133
138
|
/** @type {WeakMap<Compilation, CompilationHooks>} */
|
134
139
|
const compilationHooksMap = new WeakMap();
|
135
140
|
|
141
|
+
const PLUGIN_NAME = "JavascriptModulesPlugin";
|
142
|
+
|
136
143
|
class JavascriptModulesPlugin {
|
137
144
|
/**
|
138
145
|
* @param {Compilation} compilation the compilation
|
@@ -196,154 +203,147 @@ class JavascriptModulesPlugin {
|
|
196
203
|
*/
|
197
204
|
apply(compiler) {
|
198
205
|
compiler.hooks.compilation.tap(
|
199
|
-
|
206
|
+
PLUGIN_NAME,
|
200
207
|
(compilation, { normalModuleFactory }) => {
|
201
208
|
const hooks = JavascriptModulesPlugin.getCompilationHooks(compilation);
|
202
209
|
normalModuleFactory.hooks.createParser
|
203
|
-
.for(
|
204
|
-
.tap(
|
210
|
+
.for(JAVASCRIPT_MODULE_TYPE_AUTO)
|
211
|
+
.tap(PLUGIN_NAME, options => {
|
205
212
|
return new JavascriptParser("auto");
|
206
213
|
});
|
207
214
|
normalModuleFactory.hooks.createParser
|
208
|
-
.for(
|
209
|
-
.tap(
|
215
|
+
.for(JAVASCRIPT_MODULE_TYPE_DYNAMIC)
|
216
|
+
.tap(PLUGIN_NAME, options => {
|
210
217
|
return new JavascriptParser("script");
|
211
218
|
});
|
212
219
|
normalModuleFactory.hooks.createParser
|
213
|
-
.for(
|
214
|
-
.tap(
|
220
|
+
.for(JAVASCRIPT_MODULE_TYPE_ESM)
|
221
|
+
.tap(PLUGIN_NAME, options => {
|
215
222
|
return new JavascriptParser("module");
|
216
223
|
});
|
217
224
|
normalModuleFactory.hooks.createGenerator
|
218
|
-
.for(
|
219
|
-
.tap(
|
225
|
+
.for(JAVASCRIPT_MODULE_TYPE_AUTO)
|
226
|
+
.tap(PLUGIN_NAME, () => {
|
220
227
|
return new JavascriptGenerator();
|
221
228
|
});
|
222
229
|
normalModuleFactory.hooks.createGenerator
|
223
|
-
.for(
|
224
|
-
.tap(
|
230
|
+
.for(JAVASCRIPT_MODULE_TYPE_DYNAMIC)
|
231
|
+
.tap(PLUGIN_NAME, () => {
|
225
232
|
return new JavascriptGenerator();
|
226
233
|
});
|
227
234
|
normalModuleFactory.hooks.createGenerator
|
228
|
-
.for(
|
229
|
-
.tap(
|
235
|
+
.for(JAVASCRIPT_MODULE_TYPE_ESM)
|
236
|
+
.tap(PLUGIN_NAME, () => {
|
230
237
|
return new JavascriptGenerator();
|
231
238
|
});
|
232
|
-
compilation.hooks.renderManifest.tap(
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
codeGenerationResults
|
244
|
-
} = options;
|
239
|
+
compilation.hooks.renderManifest.tap(PLUGIN_NAME, (result, options) => {
|
240
|
+
const {
|
241
|
+
hash,
|
242
|
+
chunk,
|
243
|
+
chunkGraph,
|
244
|
+
moduleGraph,
|
245
|
+
runtimeTemplate,
|
246
|
+
dependencyTemplates,
|
247
|
+
outputOptions,
|
248
|
+
codeGenerationResults
|
249
|
+
} = options;
|
245
250
|
|
246
|
-
|
247
|
-
chunk instanceof HotUpdateChunk ? chunk : null;
|
251
|
+
const hotUpdateChunk = chunk instanceof HotUpdateChunk ? chunk : null;
|
248
252
|
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
253
|
+
let render;
|
254
|
+
const filenameTemplate =
|
255
|
+
JavascriptModulesPlugin.getChunkFilenameTemplate(
|
256
|
+
chunk,
|
257
|
+
outputOptions
|
258
|
+
);
|
259
|
+
if (hotUpdateChunk) {
|
260
|
+
render = () =>
|
261
|
+
this.renderChunk(
|
262
|
+
{
|
263
|
+
chunk,
|
264
|
+
dependencyTemplates,
|
265
|
+
runtimeTemplate,
|
266
|
+
moduleGraph,
|
267
|
+
chunkGraph,
|
268
|
+
codeGenerationResults,
|
269
|
+
strictMode: runtimeTemplate.isModule()
|
270
|
+
},
|
271
|
+
hooks
|
254
272
|
);
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
chunk,
|
275
|
-
dependencyTemplates,
|
276
|
-
runtimeTemplate,
|
277
|
-
moduleGraph,
|
278
|
-
chunkGraph,
|
279
|
-
codeGenerationResults,
|
280
|
-
strictMode: runtimeTemplate.isModule()
|
281
|
-
},
|
282
|
-
hooks,
|
283
|
-
compilation
|
284
|
-
);
|
285
|
-
} else {
|
286
|
-
if (!chunkHasJs(chunk, chunkGraph)) {
|
287
|
-
return result;
|
288
|
-
}
|
289
|
-
|
290
|
-
render = () =>
|
291
|
-
this.renderChunk(
|
292
|
-
{
|
293
|
-
chunk,
|
294
|
-
dependencyTemplates,
|
295
|
-
runtimeTemplate,
|
296
|
-
moduleGraph,
|
297
|
-
chunkGraph,
|
298
|
-
codeGenerationResults,
|
299
|
-
strictMode: runtimeTemplate.isModule()
|
300
|
-
},
|
301
|
-
hooks
|
302
|
-
);
|
273
|
+
} else if (chunk.hasRuntime()) {
|
274
|
+
render = () =>
|
275
|
+
this.renderMain(
|
276
|
+
{
|
277
|
+
hash,
|
278
|
+
chunk,
|
279
|
+
dependencyTemplates,
|
280
|
+
runtimeTemplate,
|
281
|
+
moduleGraph,
|
282
|
+
chunkGraph,
|
283
|
+
codeGenerationResults,
|
284
|
+
strictMode: runtimeTemplate.isModule()
|
285
|
+
},
|
286
|
+
hooks,
|
287
|
+
compilation
|
288
|
+
);
|
289
|
+
} else {
|
290
|
+
if (!chunkHasJs(chunk, chunkGraph)) {
|
291
|
+
return result;
|
303
292
|
}
|
304
293
|
|
305
|
-
|
306
|
-
|
307
|
-
filenameTemplate,
|
308
|
-
pathOptions: {
|
309
|
-
hash,
|
310
|
-
runtime: chunk.runtime,
|
311
|
-
chunk,
|
312
|
-
contentHashType: "javascript"
|
313
|
-
},
|
314
|
-
info: {
|
315
|
-
javascriptModule: compilation.runtimeTemplate.isModule()
|
316
|
-
},
|
317
|
-
identifier: hotUpdateChunk
|
318
|
-
? `hotupdatechunk${chunk.id}`
|
319
|
-
: `chunk${chunk.id}`,
|
320
|
-
hash: chunk.contentHash.javascript
|
321
|
-
});
|
322
|
-
|
323
|
-
return result;
|
324
|
-
}
|
325
|
-
);
|
326
|
-
compilation.hooks.chunkHash.tap(
|
327
|
-
"JavascriptModulesPlugin",
|
328
|
-
(chunk, hash, context) => {
|
329
|
-
hooks.chunkHash.call(chunk, hash, context);
|
330
|
-
if (chunk.hasRuntime()) {
|
331
|
-
this.updateHashWithBootstrap(
|
332
|
-
hash,
|
294
|
+
render = () =>
|
295
|
+
this.renderChunk(
|
333
296
|
{
|
334
|
-
hash: "0000",
|
335
297
|
chunk,
|
336
|
-
|
337
|
-
|
338
|
-
moduleGraph
|
339
|
-
|
298
|
+
dependencyTemplates,
|
299
|
+
runtimeTemplate,
|
300
|
+
moduleGraph,
|
301
|
+
chunkGraph,
|
302
|
+
codeGenerationResults,
|
303
|
+
strictMode: runtimeTemplate.isModule()
|
340
304
|
},
|
341
305
|
hooks
|
342
306
|
);
|
343
|
-
}
|
344
307
|
}
|
345
|
-
|
346
|
-
|
308
|
+
|
309
|
+
result.push({
|
310
|
+
render,
|
311
|
+
filenameTemplate,
|
312
|
+
pathOptions: {
|
313
|
+
hash,
|
314
|
+
runtime: chunk.runtime,
|
315
|
+
chunk,
|
316
|
+
contentHashType: "javascript"
|
317
|
+
},
|
318
|
+
info: {
|
319
|
+
javascriptModule: compilation.runtimeTemplate.isModule()
|
320
|
+
},
|
321
|
+
identifier: hotUpdateChunk
|
322
|
+
? `hotupdatechunk${chunk.id}`
|
323
|
+
: `chunk${chunk.id}`,
|
324
|
+
hash: chunk.contentHash.javascript
|
325
|
+
});
|
326
|
+
|
327
|
+
return result;
|
328
|
+
});
|
329
|
+
compilation.hooks.chunkHash.tap(PLUGIN_NAME, (chunk, hash, context) => {
|
330
|
+
hooks.chunkHash.call(chunk, hash, context);
|
331
|
+
if (chunk.hasRuntime()) {
|
332
|
+
this.updateHashWithBootstrap(
|
333
|
+
hash,
|
334
|
+
{
|
335
|
+
hash: "0000",
|
336
|
+
chunk,
|
337
|
+
codeGenerationResults: context.codeGenerationResults,
|
338
|
+
chunkGraph: context.chunkGraph,
|
339
|
+
moduleGraph: context.moduleGraph,
|
340
|
+
runtimeTemplate: context.runtimeTemplate
|
341
|
+
},
|
342
|
+
hooks
|
343
|
+
);
|
344
|
+
}
|
345
|
+
});
|
346
|
+
compilation.hooks.contentHash.tap(PLUGIN_NAME, chunk => {
|
347
347
|
const {
|
348
348
|
chunkGraph,
|
349
349
|
codeGenerationResults,
|
@@ -410,7 +410,7 @@ class JavascriptModulesPlugin {
|
|
410
410
|
);
|
411
411
|
});
|
412
412
|
compilation.hooks.additionalTreeRuntimeRequirements.tap(
|
413
|
-
|
413
|
+
PLUGIN_NAME,
|
414
414
|
(chunk, set, { chunkGraph }) => {
|
415
415
|
if (
|
416
416
|
!set.has(RuntimeGlobals.startupNoDefault) &&
|
@@ -421,58 +421,51 @@ class JavascriptModulesPlugin {
|
|
421
421
|
}
|
422
422
|
}
|
423
423
|
);
|
424
|
-
compilation.hooks.executeModule.tap(
|
425
|
-
"
|
426
|
-
(
|
427
|
-
|
428
|
-
|
429
|
-
if (source === undefined) return;
|
430
|
-
const { module, moduleObject } = options;
|
431
|
-
const code = source.source();
|
424
|
+
compilation.hooks.executeModule.tap(PLUGIN_NAME, (options, context) => {
|
425
|
+
const source = options.codeGenerationResult.sources.get("javascript");
|
426
|
+
if (source === undefined) return;
|
427
|
+
const { module, moduleObject } = options;
|
428
|
+
const code = source.source();
|
432
429
|
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
}
|
439
|
-
);
|
440
|
-
try {
|
441
|
-
fn.call(
|
442
|
-
moduleObject.exports,
|
443
|
-
moduleObject,
|
444
|
-
moduleObject.exports,
|
445
|
-
context.__webpack_require__
|
446
|
-
);
|
447
|
-
} catch (e) {
|
448
|
-
e.stack += printGeneratedCodeForStack(options.module, code);
|
449
|
-
throw e;
|
430
|
+
const fn = vm.runInThisContext(
|
431
|
+
`(function(${module.moduleArgument}, ${module.exportsArgument}, __webpack_require__) {\n${code}\n/**/})`,
|
432
|
+
{
|
433
|
+
filename: module.identifier(),
|
434
|
+
lineOffset: -1
|
450
435
|
}
|
436
|
+
);
|
437
|
+
try {
|
438
|
+
fn.call(
|
439
|
+
moduleObject.exports,
|
440
|
+
moduleObject,
|
441
|
+
moduleObject.exports,
|
442
|
+
context.__webpack_require__
|
443
|
+
);
|
444
|
+
} catch (e) {
|
445
|
+
e.stack += printGeneratedCodeForStack(options.module, code);
|
446
|
+
throw e;
|
451
447
|
}
|
452
|
-
);
|
453
|
-
compilation.hooks.executeModule.tap(
|
454
|
-
"
|
455
|
-
(
|
456
|
-
|
457
|
-
|
458
|
-
let code = source.source();
|
459
|
-
if (typeof code !== "string") code = code.toString();
|
448
|
+
});
|
449
|
+
compilation.hooks.executeModule.tap(PLUGIN_NAME, (options, context) => {
|
450
|
+
const source = options.codeGenerationResult.sources.get("runtime");
|
451
|
+
if (source === undefined) return;
|
452
|
+
let code = source.source();
|
453
|
+
if (typeof code !== "string") code = code.toString();
|
460
454
|
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
}
|
467
|
-
);
|
468
|
-
try {
|
469
|
-
fn.call(null, context.__webpack_require__);
|
470
|
-
} catch (e) {
|
471
|
-
e.stack += printGeneratedCodeForStack(options.module, code);
|
472
|
-
throw e;
|
455
|
+
const fn = vm.runInThisContext(
|
456
|
+
`(function(__webpack_require__) {\n${code}\n/**/})`,
|
457
|
+
{
|
458
|
+
filename: options.module.identifier(),
|
459
|
+
lineOffset: -1
|
473
460
|
}
|
461
|
+
);
|
462
|
+
try {
|
463
|
+
fn.call(null, context.__webpack_require__);
|
464
|
+
} catch (e) {
|
465
|
+
e.stack += printGeneratedCodeForStack(options.module, code);
|
466
|
+
throw e;
|
474
467
|
}
|
475
|
-
);
|
468
|
+
});
|
476
469
|
}
|
477
470
|
);
|
478
471
|
}
|
@@ -5,6 +5,7 @@
|
|
5
5
|
|
6
6
|
"use strict";
|
7
7
|
|
8
|
+
const { JSON_MODULE_TYPE } = require("../ModuleTypeConstants");
|
8
9
|
const createSchemaValidation = require("../util/create-schema-validation");
|
9
10
|
const JsonGenerator = require("./JsonGenerator");
|
10
11
|
const JsonParser = require("./JsonParser");
|
@@ -20,26 +21,33 @@ const validate = createSchemaValidation(
|
|
20
21
|
}
|
21
22
|
);
|
22
23
|
|
24
|
+
const PLUGIN_NAME = "JsonModulesPlugin";
|
25
|
+
|
26
|
+
/**
|
27
|
+
* The JsonModulesPlugin is the entrypoint plugin for the json modules feature.
|
28
|
+
* It adds the json module type to the compiler and registers the json parser and generator.
|
29
|
+
*/
|
23
30
|
class JsonModulesPlugin {
|
24
31
|
/**
|
25
32
|
* Apply the plugin
|
26
33
|
* @param {Compiler} compiler the compiler instance
|
27
34
|
* @returns {void}
|
35
|
+
*
|
28
36
|
*/
|
29
37
|
apply(compiler) {
|
30
38
|
compiler.hooks.compilation.tap(
|
31
|
-
|
39
|
+
PLUGIN_NAME,
|
32
40
|
(compilation, { normalModuleFactory }) => {
|
33
41
|
normalModuleFactory.hooks.createParser
|
34
|
-
.for(
|
35
|
-
.tap(
|
42
|
+
.for(JSON_MODULE_TYPE)
|
43
|
+
.tap(PLUGIN_NAME, parserOptions => {
|
36
44
|
validate(parserOptions);
|
37
45
|
|
38
46
|
return new JsonParser(parserOptions);
|
39
47
|
});
|
40
48
|
normalModuleFactory.hooks.createGenerator
|
41
|
-
.for(
|
42
|
-
.tap(
|
49
|
+
.for(JSON_MODULE_TYPE)
|
50
|
+
.tap(PLUGIN_NAME, () => {
|
43
51
|
return new JsonGenerator();
|
44
52
|
});
|
45
53
|
}
|
@@ -29,6 +29,7 @@ const AbstractLibraryPlugin = require("./AbstractLibraryPlugin");
|
|
29
29
|
/**
|
30
30
|
* @typedef {Object} AmdLibraryPluginParsed
|
31
31
|
* @property {string} name
|
32
|
+
* @property {string} amdContainer
|
32
33
|
*/
|
33
34
|
|
34
35
|
/**
|
@@ -52,7 +53,7 @@ class AmdLibraryPlugin extends AbstractLibraryPlugin {
|
|
52
53
|
* @returns {T | false} preprocess as needed by overriding
|
53
54
|
*/
|
54
55
|
parseOptions(library) {
|
55
|
-
const { name } = library;
|
56
|
+
const { name, amdContainer } = library;
|
56
57
|
if (this.requireAsWrapper) {
|
57
58
|
if (name) {
|
58
59
|
throw new Error(
|
@@ -67,7 +68,8 @@ class AmdLibraryPlugin extends AbstractLibraryPlugin {
|
|
67
68
|
}
|
68
69
|
}
|
69
70
|
return {
|
70
|
-
name: /** @type {string=} */ (name)
|
71
|
+
name: /** @type {string=} */ (name),
|
72
|
+
amdContainer: /** @type {string=} */ (amdContainer)
|
71
73
|
};
|
72
74
|
}
|
73
75
|
|
@@ -111,9 +113,14 @@ class AmdLibraryPlugin extends AbstractLibraryPlugin {
|
|
111
113
|
(iife || !chunk.hasRuntime() ? " return " : "\n");
|
112
114
|
const fnEnd = iife ? ";\n}" : "\n}";
|
113
115
|
|
116
|
+
let amdContainerPrefix = "";
|
117
|
+
if (options.amdContainer) {
|
118
|
+
amdContainerPrefix = `${options.amdContainer}.`;
|
119
|
+
}
|
120
|
+
|
114
121
|
if (this.requireAsWrapper) {
|
115
122
|
return new ConcatSource(
|
116
|
-
|
123
|
+
`${amdContainerPrefix}require(${externalsDepsArray}, ${fnStart}`,
|
117
124
|
source,
|
118
125
|
`${fnEnd});`
|
119
126
|
);
|
@@ -123,18 +130,24 @@ class AmdLibraryPlugin extends AbstractLibraryPlugin {
|
|
123
130
|
});
|
124
131
|
|
125
132
|
return new ConcatSource(
|
126
|
-
|
133
|
+
`${amdContainerPrefix}define(${JSON.stringify(
|
134
|
+
name
|
135
|
+
)}, ${externalsDepsArray}, ${fnStart}`,
|
127
136
|
source,
|
128
137
|
`${fnEnd});`
|
129
138
|
);
|
130
139
|
} else if (externalsArguments) {
|
131
140
|
return new ConcatSource(
|
132
|
-
|
141
|
+
`${amdContainerPrefix}define(${externalsDepsArray}, ${fnStart}`,
|
133
142
|
source,
|
134
143
|
`${fnEnd});`
|
135
144
|
);
|
136
145
|
} else {
|
137
|
-
return new ConcatSource(
|
146
|
+
return new ConcatSource(
|
147
|
+
`${amdContainerPrefix}define(${fnStart}`,
|
148
|
+
source,
|
149
|
+
`${fnEnd});`
|
150
|
+
);
|
138
151
|
}
|
139
152
|
}
|
140
153
|
|
@@ -155,6 +168,9 @@ class AmdLibraryPlugin extends AbstractLibraryPlugin {
|
|
155
168
|
chunk
|
156
169
|
});
|
157
170
|
hash.update(name);
|
171
|
+
} else if (options.amdContainer) {
|
172
|
+
hash.update("amdContainer");
|
173
|
+
hash.update(options.amdContainer);
|
158
174
|
}
|
159
175
|
}
|
160
176
|
}
|
@@ -5,6 +5,7 @@
|
|
5
5
|
|
6
6
|
"use strict";
|
7
7
|
|
8
|
+
const { WEBASSEMBLY_MODULE_TYPE_ASYNC } = require("../ModuleTypeConstants");
|
8
9
|
const RuntimeGlobals = require("../RuntimeGlobals");
|
9
10
|
const Template = require("../Template");
|
10
11
|
const AsyncWasmLoadingRuntimeModule = require("../wasm-async/AsyncWasmLoadingRuntimeModule");
|
@@ -85,7 +86,7 @@ class ReadFileCompileAsyncWasmPlugin {
|
|
85
86
|
if (
|
86
87
|
!chunkGraph.hasModuleInGraph(
|
87
88
|
chunk,
|
88
|
-
m => m.type ===
|
89
|
+
m => m.type === WEBASSEMBLY_MODULE_TYPE_ASYNC
|
89
90
|
)
|
90
91
|
) {
|
91
92
|
return;
|
@@ -5,6 +5,7 @@
|
|
5
5
|
|
6
6
|
"use strict";
|
7
7
|
|
8
|
+
const { WEBASSEMBLY_MODULE_TYPE_SYNC } = require("../ModuleTypeConstants");
|
8
9
|
const RuntimeGlobals = require("../RuntimeGlobals");
|
9
10
|
const Template = require("../Template");
|
10
11
|
const WasmChunkLoadingRuntimeModule = require("../wasm-sync/WasmChunkLoadingRuntimeModule");
|
@@ -69,7 +70,7 @@ class ReadFileCompileWasmPlugin {
|
|
69
70
|
if (
|
70
71
|
!chunkGraph.hasModuleInGraph(
|
71
72
|
chunk,
|
72
|
-
m => m.type ===
|
73
|
+
m => m.type === WEBASSEMBLY_MODULE_TYPE_SYNC
|
73
74
|
)
|
74
75
|
) {
|
75
76
|
return;
|
@@ -15,6 +15,7 @@ const {
|
|
15
15
|
const ConcatenationScope = require("../ConcatenationScope");
|
16
16
|
const { UsageState } = require("../ExportsInfo");
|
17
17
|
const Module = require("../Module");
|
18
|
+
const { JAVASCRIPT_MODULE_TYPE_ESM } = require("../ModuleTypeConstants");
|
18
19
|
const RuntimeGlobals = require("../RuntimeGlobals");
|
19
20
|
const Template = require("../Template");
|
20
21
|
const HarmonyImportDependency = require("../dependencies/HarmonyImportDependency");
|
@@ -683,7 +684,7 @@ class ConcatenatedModule extends Module {
|
|
683
684
|
* @param {Set<Module>=} options.modules all concatenated modules
|
684
685
|
*/
|
685
686
|
constructor({ identifier, rootModule, modules, runtime }) {
|
686
|
-
super(
|
687
|
+
super(JAVASCRIPT_MODULE_TYPE_ESM, null, rootModule && rootModule.layer);
|
687
688
|
|
688
689
|
// Info from Factory
|
689
690
|
/** @type {string} */
|