webpack 5.83.1 → 5.85.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 +2 -2
- package/lib/AsyncDependenciesBlock.js +2 -2
- package/lib/AutomaticPrefetchPlugin.js +1 -0
- package/lib/BannerPlugin.js +4 -0
- package/lib/CacheFacade.js +4 -0
- package/lib/ChunkGroup.js +5 -1
- package/lib/CleanPlugin.js +30 -7
- package/lib/CompatibilityPlugin.js +4 -3
- package/lib/Compilation.js +3 -3
- package/lib/Compiler.js +1 -1
- package/lib/ContextModule.js +3 -3
- package/lib/ContextModuleFactory.js +1 -1
- package/lib/DefinePlugin.js +11 -2
- package/lib/DllEntryPlugin.js +5 -0
- package/lib/DllModule.js +1 -1
- package/lib/DllModuleFactory.js +1 -1
- package/lib/EvalSourceMapDevToolPlugin.js +3 -1
- package/lib/HookWebpackError.js +1 -1
- package/lib/IgnoreErrorModuleFactory.js +1 -1
- package/lib/MainTemplate.js +2 -2
- package/lib/Module.js +21 -9
- package/lib/ModuleFactory.js +1 -1
- package/lib/ModuleTypeConstants.js +2 -1
- package/lib/NormalModuleFactory.js +1 -1
- package/lib/NormalModuleReplacementPlugin.js +4 -2
- package/lib/NullFactory.js +1 -1
- package/lib/PrefetchPlugin.js +4 -0
- package/lib/RecordIdsPlugin.js +4 -4
- package/lib/RuntimeModule.js +5 -5
- package/lib/RuntimePlugin.js +4 -0
- package/lib/RuntimeTemplate.js +7 -7
- package/lib/SelfModuleFactory.js +12 -0
- package/lib/SourceMapDevToolPlugin.js +9 -2
- package/lib/Template.js +3 -2
- package/lib/UseStrictPlugin.js +4 -0
- package/lib/WarnDeprecatedOptionPlugin.js +7 -0
- package/lib/WatchIgnorePlugin.js +4 -0
- package/lib/WebpackOptionsApply.js +2 -1
- package/lib/asset/AssetGenerator.js +7 -2
- package/lib/asset/AssetModulesPlugin.js +7 -1
- package/lib/asset/AssetParser.js +4 -1
- package/lib/asset/RawDataUrlModule.js +5 -3
- package/lib/async-modules/InferAsyncModulesPlugin.js +1 -1
- package/lib/cache/PackFileCacheStrategy.js +7 -1
- package/lib/config/browserslistTargetHandler.js +3 -3
- package/lib/config/defaults.js +240 -73
- package/lib/config/normalization.js +104 -71
- package/lib/config/target.js +37 -10
- package/lib/container/ContainerEntryModule.js +4 -0
- package/lib/container/ContainerEntryModuleFactory.js +1 -1
- package/lib/container/FallbackDependency.js +7 -0
- package/lib/container/FallbackItemDependency.js +3 -0
- package/lib/container/FallbackModule.js +5 -1
- package/lib/container/FallbackModuleFactory.js +1 -1
- package/lib/container/RemoteModule.js +4 -0
- package/lib/container/RemoteRuntimeModule.js +2 -1
- package/lib/container/RemoteToExternalDependency.js +3 -0
- package/lib/css/CssParser.js +168 -73
- package/lib/debug/ProfilingPlugin.js +11 -0
- package/lib/dependencies/AMDDefineDependency.js +12 -6
- package/lib/dependencies/AMDDefineDependencyParserPlugin.js +8 -2
- package/lib/dependencies/AMDPlugin.js +7 -0
- package/lib/dependencies/AMDRequireArrayDependency.js +5 -0
- package/lib/dependencies/AMDRequireContextDependency.js +6 -0
- package/lib/dependencies/AMDRequireDependenciesBlock.js +6 -0
- package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +8 -2
- package/lib/dependencies/AMDRequireDependency.js +8 -1
- package/lib/dependencies/AMDRequireItemDependency.js +6 -0
- package/lib/dependencies/CachedConstDependency.js +6 -0
- package/lib/dependencies/CommonJsExportRequireDependency.js +11 -0
- package/lib/dependencies/CommonJsExportsDependency.js +8 -0
- package/lib/dependencies/CommonJsExportsParserPlugin.js +2 -2
- package/lib/dependencies/CommonJsFullRequireDependency.js +2 -1
- package/lib/dependencies/CommonJsPlugin.js +28 -12
- package/lib/dependencies/CommonJsRequireContextDependency.js +8 -0
- package/lib/dependencies/CommonJsRequireDependency.js +7 -0
- package/lib/dependencies/CommonJsSelfReferenceDependency.js +8 -0
- package/lib/dependencies/ConstDependency.js +2 -1
- package/lib/dependencies/ContextDependencyHelpers.js +3 -3
- package/lib/dependencies/CreateScriptUrlDependency.js +2 -1
- package/lib/dependencies/CriticalDependencyWarning.js +3 -0
- package/lib/dependencies/CssImportDependency.js +2 -1
- package/lib/dependencies/CssLocalIdentifierDependency.js +2 -1
- package/lib/dependencies/CssSelfLocalIdentifierDependency.js +2 -1
- package/lib/dependencies/CssUrlDependency.js +12 -2
- package/lib/dependencies/DelegatedSourceDependency.js +3 -0
- package/lib/dependencies/ExportsInfoDependency.js +6 -0
- package/lib/dependencies/HarmonyAcceptDependency.js +2 -1
- package/lib/dependencies/HarmonyAcceptImportDependency.js +3 -0
- package/lib/dependencies/HarmonyDetectionParserPlugin.js +16 -0
- package/lib/dependencies/HarmonyEvaluatedImportSpecifierDependency.js +12 -1
- package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +3 -0
- package/lib/dependencies/HarmonyExportExpressionDependency.js +8 -0
- package/lib/dependencies/HarmonyExportHeaderDependency.js +5 -0
- package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +2 -1
- package/lib/dependencies/HarmonyExportSpecifierDependency.js +4 -0
- package/lib/dependencies/HarmonyExports.js +3 -1
- package/lib/dependencies/HarmonyImportDependency.js +2 -1
- package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +18 -5
- package/lib/dependencies/HarmonyImportSideEffectDependency.js +6 -0
- package/lib/dependencies/HarmonyImportSpecifierDependency.js +86 -6
- package/lib/dependencies/HarmonyModulesPlugin.js +12 -0
- package/lib/dependencies/ImportContextDependency.js +6 -0
- package/lib/dependencies/ImportDependency.js +2 -1
- package/lib/dependencies/ImportEagerDependency.js +2 -1
- package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +32 -13
- package/lib/dependencies/ImportMetaContextPlugin.js +7 -0
- package/lib/dependencies/ImportMetaHotAcceptDependency.js +6 -0
- package/lib/dependencies/ImportMetaHotDeclineDependency.js +6 -0
- package/lib/dependencies/ImportParserPlugin.js +5 -0
- package/lib/dependencies/ImportPlugin.js +7 -0
- package/lib/dependencies/ImportWeakDependency.js +2 -1
- package/lib/dependencies/LocalModule.js +16 -0
- package/lib/dependencies/LocalModuleDependency.js +7 -0
- package/lib/dependencies/LocalModulesHelpers.js +18 -0
- package/lib/dependencies/ModuleHotAcceptDependency.js +6 -0
- package/lib/dependencies/ModuleHotDeclineDependency.js +6 -0
- package/lib/dependencies/PrefetchDependency.js +3 -0
- package/lib/dependencies/ProvidedDependency.js +2 -1
- package/lib/dependencies/PureExpressionDependency.js +2 -1
- package/lib/dependencies/RequireContextDependency.js +6 -0
- package/lib/dependencies/RequireContextPlugin.js +7 -0
- package/lib/dependencies/RequireEnsureDependenciesBlock.js +4 -0
- package/lib/dependencies/RequireEnsureDependency.js +8 -2
- package/lib/dependencies/RequireEnsureItemDependency.js +3 -0
- package/lib/dependencies/RequireEnsurePlugin.js +14 -0
- package/lib/dependencies/RequireHeaderDependency.js +5 -1
- package/lib/dependencies/RequireIncludeDependency.js +5 -0
- package/lib/dependencies/RequireIncludeDependencyParserPlugin.js +3 -0
- package/lib/dependencies/RequireIncludePlugin.js +14 -0
- package/lib/dependencies/RequireResolveContextDependency.js +8 -0
- package/lib/dependencies/RequireResolveDependency.js +6 -0
- package/lib/dependencies/RequireResolveHeaderDependency.js +4 -0
- package/lib/dependencies/SystemPlugin.js +10 -1
- package/lib/dependencies/URLDependency.js +3 -2
- package/lib/dependencies/URLPlugin.js +7 -5
- package/lib/dependencies/UnsupportedDependency.js +5 -0
- package/lib/dependencies/WebAssemblyExportImportedDependency.js +6 -0
- package/lib/dependencies/WebpackIsIncludedDependency.js +5 -0
- package/lib/dependencies/WorkerDependency.js +2 -1
- package/lib/dependencies/WorkerPlugin.js +30 -3
- package/lib/dependencies/getFunctionExpression.js +7 -0
- package/lib/esm/ExportWebpackRequireRuntimeModule.js +2 -1
- package/lib/esm/ModuleChunkFormatPlugin.js +15 -7
- package/lib/esm/ModuleChunkLoadingPlugin.js +9 -0
- package/lib/esm/ModuleChunkLoadingRuntimeModule.js +14 -9
- package/lib/hmr/LazyCompilationPlugin.js +1 -1
- package/lib/ids/ChunkModuleIdRangePlugin.js +11 -0
- package/lib/ids/DeterministicChunkIdsPlugin.js +11 -2
- package/lib/ids/DeterministicModuleIdsPlugin.js +11 -7
- package/lib/ids/HashedModuleIdsPlugin.js +8 -1
- package/lib/ids/IdHelpers.js +6 -0
- package/lib/ids/NamedChunkIdsPlugin.js +13 -1
- package/lib/ids/NamedModuleIdsPlugin.js +14 -3
- package/lib/ids/OccurrenceChunkIdsPlugin.js +6 -2
- package/lib/ids/SyncModuleIdsPlugin.js +2 -2
- package/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js +3 -3
- package/lib/javascript/BasicEvaluatedExpression.js +11 -1
- package/lib/javascript/ChunkHelpers.js +2 -2
- package/lib/javascript/CommonJsChunkFormatPlugin.js +1 -1
- package/lib/javascript/EnableChunkLoadingPlugin.js +4 -0
- package/lib/javascript/JavascriptModulesPlugin.js +36 -31
- package/lib/javascript/JavascriptParser.js +586 -192
- package/lib/javascript/StartupHelpers.js +2 -2
- package/lib/json/JsonGenerator.js +7 -5
- package/lib/json/JsonParser.js +1 -1
- package/lib/library/AbstractLibraryPlugin.js +4 -0
- package/lib/library/AssignLibraryPlugin.js +6 -4
- package/lib/library/ExportPropertyLibraryPlugin.js +4 -1
- package/lib/library/ModuleLibraryPlugin.js +6 -3
- package/lib/library/SystemLibraryPlugin.js +1 -0
- package/lib/library/UmdLibraryPlugin.js +4 -0
- package/lib/node/CommonJsChunkLoadingPlugin.js +17 -2
- package/lib/node/NodeTemplatePlugin.js +10 -2
- package/lib/node/NodeWatchFileSystem.js +1 -1
- package/lib/node/ReadFileChunkLoadingRuntimeModule.js +6 -3
- package/lib/node/ReadFileCompileAsyncWasmPlugin.js +8 -0
- package/lib/node/ReadFileCompileWasmPlugin.js +19 -2
- package/lib/node/RequireChunkLoadingRuntimeModule.js +6 -3
- package/lib/optimize/ConcatenatedModule.js +1 -1
- package/lib/optimize/InnerGraphPlugin.js +11 -4
- package/lib/runtime/AsyncModuleRuntimeModule.js +1 -1
- package/lib/runtime/AutoPublicPathRuntimeModule.js +5 -1
- package/lib/runtime/BaseUriRuntimeModule.js +5 -1
- package/lib/runtime/EnsureChunkRuntimeModule.js +3 -0
- package/lib/runtime/GetChunkFilenameRuntimeModule.js +35 -16
- package/lib/runtime/GetTrustedTypesPolicyRuntimeModule.js +1 -1
- package/lib/runtime/LoadScriptRuntimeModule.js +1 -1
- package/lib/runtime/PublicPathRuntimeModule.js +5 -0
- package/lib/runtime/StartupChunkDependenciesPlugin.js +15 -0
- package/lib/runtime/StartupChunkDependenciesRuntimeModule.js +4 -1
- package/lib/runtime/StartupEntrypointRuntimeModule.js +8 -5
- package/lib/serialization/ArraySerializer.js +22 -6
- package/lib/serialization/BinaryMiddleware.js +21 -0
- package/lib/serialization/DateObjectSerializer.js +15 -4
- package/lib/serialization/ErrorObjectSerializer.js +20 -8
- package/lib/serialization/FileMiddleware.js +17 -0
- package/lib/serialization/MapObjectSerializer.js +24 -8
- package/lib/serialization/NullPrototypeObjectSerializer.js +25 -8
- package/lib/serialization/ObjectMiddleware.js +23 -0
- package/lib/serialization/PlainObjectSerializer.js +23 -12
- package/lib/serialization/RegExpObjectSerializer.js +16 -5
- package/lib/serialization/SetObjectSerializer.js +21 -6
- package/lib/sharing/ProvideSharedModuleFactory.js +1 -1
- package/lib/sharing/ShareRuntimeModule.js +1 -1
- package/lib/util/createHash.js +1 -1
- package/lib/util/makeSerializable.js +7 -0
- package/lib/util/serialization.js +10 -0
- package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +9 -0
- package/lib/wasm-async/AsyncWebAssemblyGenerator.js +9 -1
- package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +13 -3
- package/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js +19 -2
- package/lib/wasm-async/AsyncWebAssemblyParser.js +3 -0
- package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +25 -1
- package/lib/wasm-sync/WasmFinalizeExportsPlugin.js +14 -5
- package/lib/wasm-sync/WebAssemblyGenerator.js +18 -5
- package/lib/wasm-sync/WebAssemblyJavascriptGenerator.js +1 -1
- package/lib/wasm-sync/WebAssemblyModulesPlugin.js +12 -1
- package/lib/wasm-sync/WebAssemblyParser.js +9 -2
- package/lib/wasm-sync/WebAssemblyUtils.js +1 -1
- package/lib/web/FetchCompileAsyncWasmPlugin.js +9 -0
- package/lib/web/FetchCompileWasmPlugin.js +19 -2
- package/lib/web/JsonpChunkLoadingPlugin.js +9 -0
- package/lib/web/JsonpChunkLoadingRuntimeModule.js +4 -1
- package/lib/webworker/ImportScriptsChunkLoadingPlugin.js +9 -0
- package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +6 -2
- package/package.json +3 -3
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +12 -0
- package/schemas/plugins/SourceMapDevToolPlugin.check.js +1 -1
- package/schemas/plugins/SourceMapDevToolPlugin.json +4 -0
- package/types.d.ts +655 -290
@@ -130,8 +130,8 @@ const printGeneratedCodeForStack = (module, code) => {
|
|
130
130
|
* @property {SyncWaterfallHook<[Source, Module, StartupRenderContext]>} renderStartup
|
131
131
|
* @property {SyncWaterfallHook<[string, RenderBootstrapContext]>} renderRequire
|
132
132
|
* @property {SyncBailHook<[Module, RenderBootstrapContext], string>} inlineInRuntimeBailout
|
133
|
-
* @property {SyncBailHook<[Module, RenderContext], string>} embedInRuntimeBailout
|
134
|
-
* @property {SyncBailHook<[RenderContext], string>} strictRuntimeBailout
|
133
|
+
* @property {SyncBailHook<[Module, RenderContext], string | void>} embedInRuntimeBailout
|
134
|
+
* @property {SyncBailHook<[RenderContext], string | void>} strictRuntimeBailout
|
135
135
|
* @property {SyncHook<[Chunk, Hash, ChunkHashContext]>} chunkHash
|
136
136
|
* @property {SyncBailHook<[Chunk, RenderContext], boolean>} useSourceMap
|
137
137
|
*/
|
@@ -429,7 +429,7 @@ class JavascriptModulesPlugin {
|
|
429
429
|
const code = source.source();
|
430
430
|
|
431
431
|
const fn = vm.runInThisContext(
|
432
|
-
`(function(${module.moduleArgument}, ${module.exportsArgument},
|
432
|
+
`(function(${module.moduleArgument}, ${module.exportsArgument}, ${RuntimeGlobals.require}) {\n${code}\n/**/})`,
|
433
433
|
{
|
434
434
|
filename: module.identifier(),
|
435
435
|
lineOffset: -1
|
@@ -454,7 +454,7 @@ class JavascriptModulesPlugin {
|
|
454
454
|
if (typeof code !== "string") code = code.toString();
|
455
455
|
|
456
456
|
const fn = vm.runInThisContext(
|
457
|
-
`(function(
|
457
|
+
`(function(${RuntimeGlobals.require}) {\n${code}\n/**/})`,
|
458
458
|
{
|
459
459
|
filename: options.module.identifier(),
|
460
460
|
lineOffset: -1
|
@@ -557,7 +557,7 @@ class JavascriptModulesPlugin {
|
|
557
557
|
? module.exportsArgument
|
558
558
|
: "__unused_webpack_" + module.exportsArgument
|
559
559
|
);
|
560
|
-
if (needRequire) args.push(
|
560
|
+
if (needRequire) args.push(RuntimeGlobals.require);
|
561
561
|
if (!needThisAsExports && runtimeTemplate.supportsArrowFunction()) {
|
562
562
|
factorySource.add("/***/ ((" + args.join(", ") + ") => {\n\n");
|
563
563
|
} else {
|
@@ -691,6 +691,7 @@ class JavascriptModulesPlugin {
|
|
691
691
|
);
|
692
692
|
|
693
693
|
const hasEntryModules = chunkGraph.getNumberOfEntryModules(chunk) > 0;
|
694
|
+
/** @type {Set<Module> | undefined} */
|
694
695
|
let inlinedModules;
|
695
696
|
if (bootstrap.allowInlineStartup && hasEntryModules) {
|
696
697
|
inlinedModules = new Set(chunkGraph.getChunkEntryModulesIterable(chunk));
|
@@ -732,7 +733,9 @@ class JavascriptModulesPlugin {
|
|
732
733
|
const chunkModules = Template.renderChunkModules(
|
733
734
|
chunkRenderContext,
|
734
735
|
inlinedModules
|
735
|
-
? allModules.filter(
|
736
|
+
? allModules.filter(
|
737
|
+
m => !(/** @type {Set<Module>} */ (inlinedModules).has(m))
|
738
|
+
)
|
736
739
|
: allModules,
|
737
740
|
module => this.renderModule(module, chunkRenderContext, hooks, true),
|
738
741
|
prefix
|
@@ -798,7 +801,7 @@ class JavascriptModulesPlugin {
|
|
798
801
|
}
|
799
802
|
const lastInlinedModule = last(inlinedModules);
|
800
803
|
const startupSource = new ConcatSource();
|
801
|
-
startupSource.add(`var
|
804
|
+
startupSource.add(`var ${RuntimeGlobals.exports} = {};\n`);
|
802
805
|
for (const m of inlinedModules) {
|
803
806
|
const renderedModule = this.renderModule(
|
804
807
|
m,
|
@@ -814,7 +817,7 @@ class JavascriptModulesPlugin {
|
|
814
817
|
);
|
815
818
|
const exports = runtimeRequirements.has(RuntimeGlobals.exports);
|
816
819
|
const webpackExports =
|
817
|
-
exports && m.exportsArgument ===
|
820
|
+
exports && m.exportsArgument === RuntimeGlobals.exports;
|
818
821
|
let iife = innerStrict
|
819
822
|
? "it need to be in strict mode."
|
820
823
|
: inlinedModules.size > 1
|
@@ -846,9 +849,9 @@ class JavascriptModulesPlugin {
|
|
846
849
|
if (exports) {
|
847
850
|
if (m !== lastInlinedModule)
|
848
851
|
startupSource.add(`var ${m.exportsArgument} = {};\n`);
|
849
|
-
else if (m.exportsArgument !==
|
852
|
+
else if (m.exportsArgument !== RuntimeGlobals.exports)
|
850
853
|
startupSource.add(
|
851
|
-
`var ${m.exportsArgument} =
|
854
|
+
`var ${m.exportsArgument} = ${RuntimeGlobals.exports};\n`
|
852
855
|
);
|
853
856
|
}
|
854
857
|
startupSource.add(renderedModule);
|
@@ -857,7 +860,7 @@ class JavascriptModulesPlugin {
|
|
857
860
|
}
|
858
861
|
if (runtimeRequirements.has(RuntimeGlobals.onChunksLoaded)) {
|
859
862
|
startupSource.add(
|
860
|
-
|
863
|
+
`${RuntimeGlobals.exports} = ${RuntimeGlobals.onChunksLoaded}(${RuntimeGlobals.exports});\n`
|
861
864
|
);
|
862
865
|
}
|
863
866
|
source.add(
|
@@ -909,7 +912,7 @@ class JavascriptModulesPlugin {
|
|
909
912
|
hasEntryModules &&
|
910
913
|
runtimeRequirements.has(RuntimeGlobals.returnExportsFromRuntime)
|
911
914
|
) {
|
912
|
-
source.add(`${prefix}return
|
915
|
+
source.add(`${prefix}return ${RuntimeGlobals.exports};\n`);
|
913
916
|
}
|
914
917
|
if (iife) {
|
915
918
|
source.add("/******/ })()\n");
|
@@ -1038,13 +1041,13 @@ class JavascriptModulesPlugin {
|
|
1038
1041
|
|
1039
1042
|
if (useRequire) {
|
1040
1043
|
buf.push("// The require function");
|
1041
|
-
buf.push(`function
|
1044
|
+
buf.push(`function ${RuntimeGlobals.require}(moduleId) {`);
|
1042
1045
|
buf.push(Template.indent(this.renderRequire(renderContext, hooks)));
|
1043
1046
|
buf.push("}");
|
1044
1047
|
buf.push("");
|
1045
1048
|
} else if (runtimeRequirements.has(RuntimeGlobals.requireScope)) {
|
1046
1049
|
buf.push("// The require scope");
|
1047
|
-
buf.push(
|
1050
|
+
buf.push(`var ${RuntimeGlobals.require} = {};`);
|
1048
1051
|
buf.push("");
|
1049
1052
|
}
|
1050
1053
|
|
@@ -1158,32 +1161,32 @@ class JavascriptModulesPlugin {
|
|
1158
1161
|
}
|
1159
1162
|
if (chunks.length > 0) {
|
1160
1163
|
buf2.push(
|
1161
|
-
`${i === 0 ?
|
1164
|
+
`${i === 0 ? `var ${RuntimeGlobals.exports} = ` : ""}${
|
1162
1165
|
RuntimeGlobals.onChunksLoaded
|
1163
1166
|
}(undefined, ${JSON.stringify(
|
1164
1167
|
chunks.map(c => c.id)
|
1165
1168
|
)}, ${runtimeTemplate.returningFunction(
|
1166
|
-
|
1169
|
+
`${RuntimeGlobals.require}(${moduleIdExpr})`
|
1167
1170
|
)})`
|
1168
1171
|
);
|
1169
1172
|
} else if (useRequire) {
|
1170
1173
|
buf2.push(
|
1171
|
-
`${
|
1172
|
-
|
1173
|
-
}
|
1174
|
+
`${i === 0 ? `var ${RuntimeGlobals.exports} = ` : ""}${
|
1175
|
+
RuntimeGlobals.require
|
1176
|
+
}(${moduleIdExpr});`
|
1174
1177
|
);
|
1175
1178
|
} else {
|
1176
|
-
if (i === 0) buf2.push(
|
1179
|
+
if (i === 0) buf2.push(`var ${RuntimeGlobals.exports} = {};`);
|
1177
1180
|
if (requireScopeUsed) {
|
1178
1181
|
buf2.push(
|
1179
1182
|
`__webpack_modules__[${moduleIdExpr}](0, ${
|
1180
|
-
i === 0 ?
|
1181
|
-
},
|
1183
|
+
i === 0 ? RuntimeGlobals.exports : "{}"
|
1184
|
+
}, ${RuntimeGlobals.require});`
|
1182
1185
|
);
|
1183
1186
|
} else if (entryRuntimeRequirements.has(RuntimeGlobals.exports)) {
|
1184
1187
|
buf2.push(
|
1185
1188
|
`__webpack_modules__[${moduleIdExpr}](0, ${
|
1186
|
-
i === 0 ?
|
1189
|
+
i === 0 ? RuntimeGlobals.exports : "{}"
|
1187
1190
|
});`
|
1188
1191
|
);
|
1189
1192
|
} else {
|
@@ -1193,7 +1196,7 @@ class JavascriptModulesPlugin {
|
|
1193
1196
|
}
|
1194
1197
|
if (runtimeRequirements.has(RuntimeGlobals.onChunksLoaded)) {
|
1195
1198
|
buf2.push(
|
1196
|
-
|
1199
|
+
`${RuntimeGlobals.exports} = ${RuntimeGlobals.onChunksLoaded}(${RuntimeGlobals.exports});`
|
1197
1200
|
);
|
1198
1201
|
}
|
1199
1202
|
if (
|
@@ -1206,13 +1209,13 @@ class JavascriptModulesPlugin {
|
|
1206
1209
|
buf.push(
|
1207
1210
|
`${RuntimeGlobals.startup} = ${runtimeTemplate.basicFunction("", [
|
1208
1211
|
...buf2,
|
1209
|
-
|
1212
|
+
`return ${RuntimeGlobals.exports};`
|
1210
1213
|
])};`
|
1211
1214
|
);
|
1212
1215
|
buf.push("");
|
1213
1216
|
startup.push("// run startup");
|
1214
1217
|
startup.push(
|
1215
|
-
`var
|
1218
|
+
`var ${RuntimeGlobals.exports} = ${RuntimeGlobals.startup}();`
|
1216
1219
|
);
|
1217
1220
|
} else if (runtimeRequirements.has(RuntimeGlobals.startupOnlyBefore)) {
|
1218
1221
|
buf.push("// the startup function");
|
@@ -1260,7 +1263,9 @@ class JavascriptModulesPlugin {
|
|
1260
1263
|
`${RuntimeGlobals.startup} = ${runtimeTemplate.emptyFunction()};`
|
1261
1264
|
);
|
1262
1265
|
startup.push("// run startup");
|
1263
|
-
startup.push(
|
1266
|
+
startup.push(
|
1267
|
+
`var ${RuntimeGlobals.exports} = ${RuntimeGlobals.startup}();`
|
1268
|
+
);
|
1264
1269
|
}
|
1265
1270
|
return result;
|
1266
1271
|
}
|
@@ -1281,17 +1286,17 @@ class JavascriptModulesPlugin {
|
|
1281
1286
|
RuntimeGlobals.interceptModuleExecution
|
1282
1287
|
)
|
1283
1288
|
? Template.asString([
|
1284
|
-
|
1289
|
+
`var execOptions = { id: moduleId, module: module, factory: __webpack_modules__[moduleId], require: ${RuntimeGlobals.require} };`,
|
1285
1290
|
`${RuntimeGlobals.interceptModuleExecution}.forEach(function(handler) { handler(execOptions); });`,
|
1286
1291
|
"module = execOptions.module;",
|
1287
1292
|
"execOptions.factory.call(module.exports, module, module.exports, execOptions.require);"
|
1288
1293
|
])
|
1289
1294
|
: runtimeRequirements.has(RuntimeGlobals.thisAsExports)
|
1290
1295
|
? Template.asString([
|
1291
|
-
|
1296
|
+
`__webpack_modules__[moduleId].call(module.exports, module, module.exports, ${RuntimeGlobals.require});`
|
1292
1297
|
])
|
1293
1298
|
: Template.asString([
|
1294
|
-
|
1299
|
+
`__webpack_modules__[moduleId](module, module.exports, ${RuntimeGlobals.require});`
|
1295
1300
|
]);
|
1296
1301
|
const needModuleId = runtimeRequirements.has(RuntimeGlobals.moduleId);
|
1297
1302
|
const needModuleLoaded = runtimeRequirements.has(
|
@@ -1346,7 +1351,7 @@ class JavascriptModulesPlugin {
|
|
1346
1351
|
? Template.asString([
|
1347
1352
|
"",
|
1348
1353
|
"// Flag the module as loaded",
|
1349
|
-
|
1354
|
+
`${RuntimeGlobals.moduleLoaded} = true;`,
|
1350
1355
|
""
|
1351
1356
|
])
|
1352
1357
|
: "",
|