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.

Files changed (232) hide show
  1. package/README.md +2 -2
  2. package/lib/AsyncDependenciesBlock.js +2 -2
  3. package/lib/AutomaticPrefetchPlugin.js +1 -0
  4. package/lib/BannerPlugin.js +4 -0
  5. package/lib/CacheFacade.js +4 -0
  6. package/lib/ChunkGroup.js +5 -1
  7. package/lib/CleanPlugin.js +30 -7
  8. package/lib/CompatibilityPlugin.js +4 -3
  9. package/lib/Compilation.js +3 -3
  10. package/lib/Compiler.js +1 -1
  11. package/lib/ContextModule.js +3 -3
  12. package/lib/ContextModuleFactory.js +1 -1
  13. package/lib/DefinePlugin.js +11 -2
  14. package/lib/DllEntryPlugin.js +5 -0
  15. package/lib/DllModule.js +1 -1
  16. package/lib/DllModuleFactory.js +1 -1
  17. package/lib/EvalSourceMapDevToolPlugin.js +3 -1
  18. package/lib/HookWebpackError.js +1 -1
  19. package/lib/IgnoreErrorModuleFactory.js +1 -1
  20. package/lib/MainTemplate.js +2 -2
  21. package/lib/Module.js +21 -9
  22. package/lib/ModuleFactory.js +1 -1
  23. package/lib/ModuleTypeConstants.js +2 -1
  24. package/lib/NormalModuleFactory.js +1 -1
  25. package/lib/NormalModuleReplacementPlugin.js +4 -2
  26. package/lib/NullFactory.js +1 -1
  27. package/lib/PrefetchPlugin.js +4 -0
  28. package/lib/RecordIdsPlugin.js +4 -4
  29. package/lib/RuntimeModule.js +5 -5
  30. package/lib/RuntimePlugin.js +4 -0
  31. package/lib/RuntimeTemplate.js +7 -7
  32. package/lib/SelfModuleFactory.js +12 -0
  33. package/lib/SourceMapDevToolPlugin.js +9 -2
  34. package/lib/Template.js +3 -2
  35. package/lib/UseStrictPlugin.js +4 -0
  36. package/lib/WarnDeprecatedOptionPlugin.js +7 -0
  37. package/lib/WatchIgnorePlugin.js +4 -0
  38. package/lib/WebpackOptionsApply.js +2 -1
  39. package/lib/asset/AssetGenerator.js +7 -2
  40. package/lib/asset/AssetModulesPlugin.js +7 -1
  41. package/lib/asset/AssetParser.js +4 -1
  42. package/lib/asset/RawDataUrlModule.js +5 -3
  43. package/lib/async-modules/InferAsyncModulesPlugin.js +1 -1
  44. package/lib/cache/PackFileCacheStrategy.js +7 -1
  45. package/lib/config/browserslistTargetHandler.js +3 -3
  46. package/lib/config/defaults.js +240 -73
  47. package/lib/config/normalization.js +104 -71
  48. package/lib/config/target.js +37 -10
  49. package/lib/container/ContainerEntryModule.js +4 -0
  50. package/lib/container/ContainerEntryModuleFactory.js +1 -1
  51. package/lib/container/FallbackDependency.js +7 -0
  52. package/lib/container/FallbackItemDependency.js +3 -0
  53. package/lib/container/FallbackModule.js +5 -1
  54. package/lib/container/FallbackModuleFactory.js +1 -1
  55. package/lib/container/RemoteModule.js +4 -0
  56. package/lib/container/RemoteRuntimeModule.js +2 -1
  57. package/lib/container/RemoteToExternalDependency.js +3 -0
  58. package/lib/css/CssParser.js +168 -73
  59. package/lib/debug/ProfilingPlugin.js +11 -0
  60. package/lib/dependencies/AMDDefineDependency.js +12 -6
  61. package/lib/dependencies/AMDDefineDependencyParserPlugin.js +8 -2
  62. package/lib/dependencies/AMDPlugin.js +7 -0
  63. package/lib/dependencies/AMDRequireArrayDependency.js +5 -0
  64. package/lib/dependencies/AMDRequireContextDependency.js +6 -0
  65. package/lib/dependencies/AMDRequireDependenciesBlock.js +6 -0
  66. package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +8 -2
  67. package/lib/dependencies/AMDRequireDependency.js +8 -1
  68. package/lib/dependencies/AMDRequireItemDependency.js +6 -0
  69. package/lib/dependencies/CachedConstDependency.js +6 -0
  70. package/lib/dependencies/CommonJsExportRequireDependency.js +11 -0
  71. package/lib/dependencies/CommonJsExportsDependency.js +8 -0
  72. package/lib/dependencies/CommonJsExportsParserPlugin.js +2 -2
  73. package/lib/dependencies/CommonJsFullRequireDependency.js +2 -1
  74. package/lib/dependencies/CommonJsPlugin.js +28 -12
  75. package/lib/dependencies/CommonJsRequireContextDependency.js +8 -0
  76. package/lib/dependencies/CommonJsRequireDependency.js +7 -0
  77. package/lib/dependencies/CommonJsSelfReferenceDependency.js +8 -0
  78. package/lib/dependencies/ConstDependency.js +2 -1
  79. package/lib/dependencies/ContextDependencyHelpers.js +3 -3
  80. package/lib/dependencies/CreateScriptUrlDependency.js +2 -1
  81. package/lib/dependencies/CriticalDependencyWarning.js +3 -0
  82. package/lib/dependencies/CssImportDependency.js +2 -1
  83. package/lib/dependencies/CssLocalIdentifierDependency.js +2 -1
  84. package/lib/dependencies/CssSelfLocalIdentifierDependency.js +2 -1
  85. package/lib/dependencies/CssUrlDependency.js +12 -2
  86. package/lib/dependencies/DelegatedSourceDependency.js +3 -0
  87. package/lib/dependencies/ExportsInfoDependency.js +6 -0
  88. package/lib/dependencies/HarmonyAcceptDependency.js +2 -1
  89. package/lib/dependencies/HarmonyAcceptImportDependency.js +3 -0
  90. package/lib/dependencies/HarmonyDetectionParserPlugin.js +16 -0
  91. package/lib/dependencies/HarmonyEvaluatedImportSpecifierDependency.js +12 -1
  92. package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +3 -0
  93. package/lib/dependencies/HarmonyExportExpressionDependency.js +8 -0
  94. package/lib/dependencies/HarmonyExportHeaderDependency.js +5 -0
  95. package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +2 -1
  96. package/lib/dependencies/HarmonyExportSpecifierDependency.js +4 -0
  97. package/lib/dependencies/HarmonyExports.js +3 -1
  98. package/lib/dependencies/HarmonyImportDependency.js +2 -1
  99. package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +18 -5
  100. package/lib/dependencies/HarmonyImportSideEffectDependency.js +6 -0
  101. package/lib/dependencies/HarmonyImportSpecifierDependency.js +86 -6
  102. package/lib/dependencies/HarmonyModulesPlugin.js +12 -0
  103. package/lib/dependencies/ImportContextDependency.js +6 -0
  104. package/lib/dependencies/ImportDependency.js +2 -1
  105. package/lib/dependencies/ImportEagerDependency.js +2 -1
  106. package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +32 -13
  107. package/lib/dependencies/ImportMetaContextPlugin.js +7 -0
  108. package/lib/dependencies/ImportMetaHotAcceptDependency.js +6 -0
  109. package/lib/dependencies/ImportMetaHotDeclineDependency.js +6 -0
  110. package/lib/dependencies/ImportParserPlugin.js +5 -0
  111. package/lib/dependencies/ImportPlugin.js +7 -0
  112. package/lib/dependencies/ImportWeakDependency.js +2 -1
  113. package/lib/dependencies/LocalModule.js +16 -0
  114. package/lib/dependencies/LocalModuleDependency.js +7 -0
  115. package/lib/dependencies/LocalModulesHelpers.js +18 -0
  116. package/lib/dependencies/ModuleHotAcceptDependency.js +6 -0
  117. package/lib/dependencies/ModuleHotDeclineDependency.js +6 -0
  118. package/lib/dependencies/PrefetchDependency.js +3 -0
  119. package/lib/dependencies/ProvidedDependency.js +2 -1
  120. package/lib/dependencies/PureExpressionDependency.js +2 -1
  121. package/lib/dependencies/RequireContextDependency.js +6 -0
  122. package/lib/dependencies/RequireContextPlugin.js +7 -0
  123. package/lib/dependencies/RequireEnsureDependenciesBlock.js +4 -0
  124. package/lib/dependencies/RequireEnsureDependency.js +8 -2
  125. package/lib/dependencies/RequireEnsureItemDependency.js +3 -0
  126. package/lib/dependencies/RequireEnsurePlugin.js +14 -0
  127. package/lib/dependencies/RequireHeaderDependency.js +5 -1
  128. package/lib/dependencies/RequireIncludeDependency.js +5 -0
  129. package/lib/dependencies/RequireIncludeDependencyParserPlugin.js +3 -0
  130. package/lib/dependencies/RequireIncludePlugin.js +14 -0
  131. package/lib/dependencies/RequireResolveContextDependency.js +8 -0
  132. package/lib/dependencies/RequireResolveDependency.js +6 -0
  133. package/lib/dependencies/RequireResolveHeaderDependency.js +4 -0
  134. package/lib/dependencies/SystemPlugin.js +10 -1
  135. package/lib/dependencies/URLDependency.js +3 -2
  136. package/lib/dependencies/URLPlugin.js +7 -5
  137. package/lib/dependencies/UnsupportedDependency.js +5 -0
  138. package/lib/dependencies/WebAssemblyExportImportedDependency.js +6 -0
  139. package/lib/dependencies/WebpackIsIncludedDependency.js +5 -0
  140. package/lib/dependencies/WorkerDependency.js +2 -1
  141. package/lib/dependencies/WorkerPlugin.js +30 -3
  142. package/lib/dependencies/getFunctionExpression.js +7 -0
  143. package/lib/esm/ExportWebpackRequireRuntimeModule.js +2 -1
  144. package/lib/esm/ModuleChunkFormatPlugin.js +15 -7
  145. package/lib/esm/ModuleChunkLoadingPlugin.js +9 -0
  146. package/lib/esm/ModuleChunkLoadingRuntimeModule.js +14 -9
  147. package/lib/hmr/LazyCompilationPlugin.js +1 -1
  148. package/lib/ids/ChunkModuleIdRangePlugin.js +11 -0
  149. package/lib/ids/DeterministicChunkIdsPlugin.js +11 -2
  150. package/lib/ids/DeterministicModuleIdsPlugin.js +11 -7
  151. package/lib/ids/HashedModuleIdsPlugin.js +8 -1
  152. package/lib/ids/IdHelpers.js +6 -0
  153. package/lib/ids/NamedChunkIdsPlugin.js +13 -1
  154. package/lib/ids/NamedModuleIdsPlugin.js +14 -3
  155. package/lib/ids/OccurrenceChunkIdsPlugin.js +6 -2
  156. package/lib/ids/SyncModuleIdsPlugin.js +2 -2
  157. package/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js +3 -3
  158. package/lib/javascript/BasicEvaluatedExpression.js +11 -1
  159. package/lib/javascript/ChunkHelpers.js +2 -2
  160. package/lib/javascript/CommonJsChunkFormatPlugin.js +1 -1
  161. package/lib/javascript/EnableChunkLoadingPlugin.js +4 -0
  162. package/lib/javascript/JavascriptModulesPlugin.js +36 -31
  163. package/lib/javascript/JavascriptParser.js +586 -192
  164. package/lib/javascript/StartupHelpers.js +2 -2
  165. package/lib/json/JsonGenerator.js +7 -5
  166. package/lib/json/JsonParser.js +1 -1
  167. package/lib/library/AbstractLibraryPlugin.js +4 -0
  168. package/lib/library/AssignLibraryPlugin.js +6 -4
  169. package/lib/library/ExportPropertyLibraryPlugin.js +4 -1
  170. package/lib/library/ModuleLibraryPlugin.js +6 -3
  171. package/lib/library/SystemLibraryPlugin.js +1 -0
  172. package/lib/library/UmdLibraryPlugin.js +4 -0
  173. package/lib/node/CommonJsChunkLoadingPlugin.js +17 -2
  174. package/lib/node/NodeTemplatePlugin.js +10 -2
  175. package/lib/node/NodeWatchFileSystem.js +1 -1
  176. package/lib/node/ReadFileChunkLoadingRuntimeModule.js +6 -3
  177. package/lib/node/ReadFileCompileAsyncWasmPlugin.js +8 -0
  178. package/lib/node/ReadFileCompileWasmPlugin.js +19 -2
  179. package/lib/node/RequireChunkLoadingRuntimeModule.js +6 -3
  180. package/lib/optimize/ConcatenatedModule.js +1 -1
  181. package/lib/optimize/InnerGraphPlugin.js +11 -4
  182. package/lib/runtime/AsyncModuleRuntimeModule.js +1 -1
  183. package/lib/runtime/AutoPublicPathRuntimeModule.js +5 -1
  184. package/lib/runtime/BaseUriRuntimeModule.js +5 -1
  185. package/lib/runtime/EnsureChunkRuntimeModule.js +3 -0
  186. package/lib/runtime/GetChunkFilenameRuntimeModule.js +35 -16
  187. package/lib/runtime/GetTrustedTypesPolicyRuntimeModule.js +1 -1
  188. package/lib/runtime/LoadScriptRuntimeModule.js +1 -1
  189. package/lib/runtime/PublicPathRuntimeModule.js +5 -0
  190. package/lib/runtime/StartupChunkDependenciesPlugin.js +15 -0
  191. package/lib/runtime/StartupChunkDependenciesRuntimeModule.js +4 -1
  192. package/lib/runtime/StartupEntrypointRuntimeModule.js +8 -5
  193. package/lib/serialization/ArraySerializer.js +22 -6
  194. package/lib/serialization/BinaryMiddleware.js +21 -0
  195. package/lib/serialization/DateObjectSerializer.js +15 -4
  196. package/lib/serialization/ErrorObjectSerializer.js +20 -8
  197. package/lib/serialization/FileMiddleware.js +17 -0
  198. package/lib/serialization/MapObjectSerializer.js +24 -8
  199. package/lib/serialization/NullPrototypeObjectSerializer.js +25 -8
  200. package/lib/serialization/ObjectMiddleware.js +23 -0
  201. package/lib/serialization/PlainObjectSerializer.js +23 -12
  202. package/lib/serialization/RegExpObjectSerializer.js +16 -5
  203. package/lib/serialization/SetObjectSerializer.js +21 -6
  204. package/lib/sharing/ProvideSharedModuleFactory.js +1 -1
  205. package/lib/sharing/ShareRuntimeModule.js +1 -1
  206. package/lib/util/createHash.js +1 -1
  207. package/lib/util/makeSerializable.js +7 -0
  208. package/lib/util/serialization.js +10 -0
  209. package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +9 -0
  210. package/lib/wasm-async/AsyncWebAssemblyGenerator.js +9 -1
  211. package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +13 -3
  212. package/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js +19 -2
  213. package/lib/wasm-async/AsyncWebAssemblyParser.js +3 -0
  214. package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +25 -1
  215. package/lib/wasm-sync/WasmFinalizeExportsPlugin.js +14 -5
  216. package/lib/wasm-sync/WebAssemblyGenerator.js +18 -5
  217. package/lib/wasm-sync/WebAssemblyJavascriptGenerator.js +1 -1
  218. package/lib/wasm-sync/WebAssemblyModulesPlugin.js +12 -1
  219. package/lib/wasm-sync/WebAssemblyParser.js +9 -2
  220. package/lib/wasm-sync/WebAssemblyUtils.js +1 -1
  221. package/lib/web/FetchCompileAsyncWasmPlugin.js +9 -0
  222. package/lib/web/FetchCompileWasmPlugin.js +19 -2
  223. package/lib/web/JsonpChunkLoadingPlugin.js +9 -0
  224. package/lib/web/JsonpChunkLoadingRuntimeModule.js +4 -1
  225. package/lib/webworker/ImportScriptsChunkLoadingPlugin.js +9 -0
  226. package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +6 -2
  227. package/package.json +3 -3
  228. package/schemas/WebpackOptions.check.js +1 -1
  229. package/schemas/WebpackOptions.json +12 -0
  230. package/schemas/plugins/SourceMapDevToolPlugin.check.js +1 -1
  231. package/schemas/plugins/SourceMapDevToolPlugin.json +4 -0
  232. 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}, __webpack_require__) {\n${code}\n/**/})`,
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(__webpack_require__) {\n${code}\n/**/})`,
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("__webpack_require__");
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(m => !inlinedModules.has(m))
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 __webpack_exports__ = {};\n`);
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 === "__webpack_exports__";
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 !== "__webpack_exports__")
852
+ else if (m.exportsArgument !== RuntimeGlobals.exports)
850
853
  startupSource.add(
851
- `var ${m.exportsArgument} = __webpack_exports__;\n`
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
- `__webpack_exports__ = ${RuntimeGlobals.onChunksLoaded}(__webpack_exports__);\n`
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 __webpack_exports__;\n`);
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 __webpack_require__(moduleId) {`);
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("var __webpack_require__ = {};");
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 ? "var __webpack_exports__ = " : ""}${
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
- `__webpack_require__(${moduleIdExpr})`
1169
+ `${RuntimeGlobals.require}(${moduleIdExpr})`
1167
1170
  )})`
1168
1171
  );
1169
1172
  } else if (useRequire) {
1170
1173
  buf2.push(
1171
- `${
1172
- i === 0 ? "var __webpack_exports__ = " : ""
1173
- }__webpack_require__(${moduleIdExpr});`
1174
+ `${i === 0 ? `var ${RuntimeGlobals.exports} = ` : ""}${
1175
+ RuntimeGlobals.require
1176
+ }(${moduleIdExpr});`
1174
1177
  );
1175
1178
  } else {
1176
- if (i === 0) buf2.push("var __webpack_exports__ = {};");
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 ? "__webpack_exports__" : "{}"
1181
- }, __webpack_require__);`
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 ? "__webpack_exports__" : "{}"
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
- `__webpack_exports__ = ${RuntimeGlobals.onChunksLoaded}(__webpack_exports__);`
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
- "return __webpack_exports__;"
1212
+ `return ${RuntimeGlobals.exports};`
1210
1213
  ])};`
1211
1214
  );
1212
1215
  buf.push("");
1213
1216
  startup.push("// run startup");
1214
1217
  startup.push(
1215
- `var __webpack_exports__ = ${RuntimeGlobals.startup}();`
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(`var __webpack_exports__ = ${RuntimeGlobals.startup}();`);
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
- "var execOptions = { id: moduleId, module: module, factory: __webpack_modules__[moduleId], require: __webpack_require__ };",
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
- "__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);"
1296
+ `__webpack_modules__[moduleId].call(module.exports, module, module.exports, ${RuntimeGlobals.require});`
1292
1297
  ])
1293
1298
  : Template.asString([
1294
- "__webpack_modules__[moduleId](module, module.exports, __webpack_require__);"
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
- "module.loaded = true;",
1354
+ `${RuntimeGlobals.moduleLoaded} = true;`,
1350
1355
  ""
1351
1356
  ])
1352
1357
  : "",