webpack 5.112.0 → 5.112.1

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.
Files changed (263) hide show
  1. package/bin/webpack.js +13 -7
  2. package/lib/Compilation.js +152 -60
  3. package/lib/Compiler.js +12 -25
  4. package/lib/asset/AssetBytesGenerator.js +14 -6
  5. package/lib/asset/AssetBytesParser.js +10 -8
  6. package/lib/asset/AssetGenerator.js +36 -48
  7. package/lib/asset/AssetModule.js +11 -0
  8. package/lib/asset/AssetModulesPlugin.js +5 -4
  9. package/lib/asset/AssetParser.js +8 -8
  10. package/lib/asset/AssetSourceGenerator.js +16 -8
  11. package/lib/asset/AssetSourceParser.js +10 -8
  12. package/lib/asset/WebManifestGenerator.js +11 -6
  13. package/lib/asset/WebManifestParser.js +3 -3
  14. package/lib/async-modules/AsyncModuleHelpers.js +8 -2
  15. package/lib/async-modules/InferAsyncModulesPlugin.js +7 -2
  16. package/lib/cache/CacheFacade.js +1 -1
  17. package/lib/cache/PackFileCacheStrategy.js +6 -10
  18. package/lib/cache/ResolverCachePlugin.js +58 -8
  19. package/lib/config/WebpackOptionsApply.js +8 -28
  20. package/lib/config/cli.js +9 -6
  21. package/lib/config/defaults.js +24 -13
  22. package/lib/config/getClaimedAssetTypes.js +2 -2
  23. package/lib/config/target.js +1 -1
  24. package/lib/context/ContextModule.js +1 -1
  25. package/lib/context/ContextModuleFactory.js +1 -1
  26. package/lib/context/ContextReplacementPlugin.js +3 -9
  27. package/lib/css/CssGenerator.js +40 -37
  28. package/lib/css/CssModule.js +10 -0
  29. package/lib/css/CssModulesPlugin.js +2 -2
  30. package/lib/css/CssParser.js +33 -32
  31. package/lib/css/conventions.js +1 -1
  32. package/lib/css/data.js +224 -219
  33. package/lib/css/syntax-parser.js +1159 -298
  34. package/lib/css/syntax-printer.js +90 -35
  35. package/lib/debug/ProfilingPlugin.js +65 -43
  36. package/lib/define/DefinePlugin.js +10 -15
  37. package/lib/define/DotenvPlugin.js +10 -6
  38. package/lib/define/EnvironmentPlugin.js +4 -2
  39. package/lib/dependencies/amd/AMDDefineDependencyParserPlugin.js +1 -2
  40. package/lib/dependencies/amd/AMDRequireDependenciesBlockParserPlugin.js +4 -1
  41. package/lib/dependencies/commonjs/CommonJsExportRequireDependency.js +1 -4
  42. package/lib/dependencies/commonjs/CommonJsExportsParserPlugin.js +18 -33
  43. package/lib/dependencies/commonjs/CommonJsImportsParserPlugin.js +1 -3
  44. package/lib/dependencies/commonjs/CommonJsObjectExportDependency.js +4 -4
  45. package/lib/dependencies/commonjs/CommonJsPlugin.js +2 -5
  46. package/lib/dependencies/commonjs/RequireEnsureDependenciesBlockParserPlugin.js +4 -1
  47. package/lib/dependencies/context/ImportMetaContextDependencyParserPlugin.js +1 -2
  48. package/lib/dependencies/context/ImportMetaGlobDependencyParserPlugin.js +4 -7
  49. package/lib/dependencies/context/ImportMetaGlobHelpers.js +8 -10
  50. package/lib/dependencies/core/CachedConstDependency.js +9 -6
  51. package/lib/dependencies/css/CssIcssExportDependency.js +6 -7
  52. package/lib/dependencies/css/CssIcssImportDependency.js +1 -3
  53. package/lib/dependencies/css/CssUrlDependency.js +2 -6
  54. package/lib/dependencies/esm/ESMDetectionParserPlugin.js +2 -4
  55. package/lib/dependencies/esm/ESMExportExpressionDependency.js +2 -2
  56. package/lib/dependencies/esm/ESMExportImportedSpecifierDependency.js +16 -18
  57. package/lib/dependencies/esm/ESMExportSpecifierDependency.js +20 -3
  58. package/lib/dependencies/esm/ESMExports.js +2 -10
  59. package/lib/dependencies/esm/ESMImportDependency.js +17 -2
  60. package/lib/dependencies/esm/ESMImportDependencyParserPlugin.js +6 -17
  61. package/lib/dependencies/esm/ESMImportGuard.js +11 -23
  62. package/lib/dependencies/esm/ESMImportSideEffectDependency.js +1 -1
  63. package/lib/dependencies/esm/ESMImportSpecifierDependency.js +4 -1
  64. package/lib/dependencies/esm/ESMLiveExportDependency.js +311 -0
  65. package/lib/dependencies/esm/ESMLiveExportParserPlugin.js +862 -0
  66. package/lib/dependencies/esm/ESMModulesPlugin.js +1 -3
  67. package/lib/dependencies/esm/TopLevelAwaitDependency.js +1 -8
  68. package/lib/dependencies/helpers/DynamicExports.js +4 -6
  69. package/lib/dependencies/html/HtmlEntryDependency.js +5 -14
  70. package/lib/dependencies/html/HtmlInlineHtmlDependency.js +1 -4
  71. package/lib/dependencies/html/HtmlInlineScriptDependency.js +2 -6
  72. package/lib/dependencies/html/HtmlInlineStyleDependency.js +1 -4
  73. package/lib/dependencies/import/ImportParserPlugin.js +3 -6
  74. package/lib/dependencies/import-meta/ImportMetaPlugin.js +4 -6
  75. package/lib/dependencies/url/URLParserPlugin.js +1 -1
  76. package/lib/dependencies/worker/WorkerAndWorkletPlugin.js +51 -20
  77. package/lib/devtool/ModuleFilenameHelpers.js +1 -1
  78. package/lib/devtool/SourceMapDevToolPlugin.js +1 -1
  79. package/lib/dll/DelegatedModule.js +3 -3
  80. package/lib/dll/DllModule.js +3 -1
  81. package/lib/dll/DllReferencePlugin.js +1 -4
  82. package/lib/errors/AbstractMethodError.js +1 -1
  83. package/lib/errors/ErrorHelpers.js +2 -1
  84. package/lib/errors/HookWebpackError.js +2 -1
  85. package/lib/errors/JSONParseError.js +4 -4
  86. package/lib/errors/WebpackError.js +3 -2
  87. package/lib/esm/ModuleChunkFormatPlugin.js +36 -1
  88. package/lib/externals/ExternalModule.js +12 -9
  89. package/lib/externals/ExternalModuleFactoryPlugin.js +1 -2
  90. package/lib/externals/ExternalsPlugin.js +1 -1
  91. package/lib/fs/FileSystemInfo.js +4 -4
  92. package/lib/graph/AsyncDependenciesBlock.js +1 -1
  93. package/lib/graph/ChunkGraph.js +5 -0
  94. package/lib/graph/Dependency.js +8 -2
  95. package/lib/graph/ExportsInfo.js +1 -1
  96. package/lib/graph/ModuleGraph.js +14 -3
  97. package/lib/graph/buildChunkGraph.js +17 -19
  98. package/lib/graph/findGraphRoots.js +1 -1
  99. package/lib/hmr/HotModuleReplacement.runtime.js +10 -9
  100. package/lib/hmr/HotModuleReplacementPlugin.js +5 -11
  101. package/lib/hmr/JavascriptHotModuleReplacement.runtime.js +16 -19
  102. package/lib/hmr/LazyCompilationPlugin.js +1 -7
  103. package/lib/html/HtmlGenerator.js +25 -17
  104. package/lib/html/HtmlModule.js +11 -1
  105. package/lib/html/HtmlModulesPlugin.js +12 -11
  106. package/lib/html/HtmlParser.js +10 -9
  107. package/lib/html/builtinEmbeddedRenderer.js +31 -33
  108. package/lib/html/data.js +42 -21
  109. package/lib/html/htmlMinify.js +4 -1
  110. package/lib/html/syntax-parser.js +34 -35
  111. package/lib/html/syntax-printer.js +2 -3
  112. package/lib/html/xmlMinify.js +4 -1
  113. package/lib/ids/HashedModuleIdsPlugin.js +1 -1
  114. package/lib/index.js +13 -12
  115. package/lib/javascript/APIPlugin.js +7 -13
  116. package/lib/javascript/BasicEvaluatedExpression.js +5 -5
  117. package/lib/javascript/CommonJsChunkFormatPlugin.js +2 -7
  118. package/lib/javascript/ConstPlugin.js +1 -1
  119. package/lib/javascript/JavascriptGenerator.js +16 -11
  120. package/lib/javascript/JavascriptMetaInfoPlugin.js +3 -15
  121. package/lib/javascript/JavascriptModule.js +10 -0
  122. package/lib/javascript/JavascriptModulesPlugin.js +2 -4
  123. package/lib/javascript/JavascriptParser.js +99 -11
  124. package/lib/javascript/ScopeAnalyzer.js +183 -107
  125. package/lib/javascript/UseStrictPlugin.js +2 -5
  126. package/lib/javascript/jsMinify.js +1 -1
  127. package/lib/javascript/regexp.js +2 -2
  128. package/lib/javascript/syntax-parser.js +2114 -1506
  129. package/lib/javascript/syntax-printer-data.js +167 -1
  130. package/lib/javascript/syntax-printer.js +9554 -2782
  131. package/lib/json/JsonGenerator.js +15 -7
  132. package/lib/json/JsonModule.js +11 -0
  133. package/lib/json/JsonParser.js +7 -6
  134. package/lib/library/AssignLibraryPlugin.js +1 -1
  135. package/lib/library/JsonpLibraryPlugin.js +1 -1
  136. package/lib/library/ModuleLibraryPlugin.js +399 -23
  137. package/lib/loaders/LoaderRunner.js +76 -38
  138. package/lib/loaders/loadLoader.js +16 -10
  139. package/lib/module/Generator.js +17 -9
  140. package/lib/module/Module.js +2 -2
  141. package/lib/module/NormalModule.js +7 -5
  142. package/lib/module/NormalModuleFactory.js +11 -17
  143. package/lib/module/Parser.js +9 -2
  144. package/lib/module/extractSourceMap.js +69 -18
  145. package/lib/module/findCaseMismatch.js +2 -2
  146. package/lib/node/ExternalModuleInitFragment.js +2 -2
  147. package/lib/node/ReadFileCompileAsyncWasmPlugin.js +4 -12
  148. package/lib/node/ReadFileCompileWasmPlugin.js +2 -6
  149. package/lib/node/nodeConsole.js +4 -3
  150. package/lib/optimize/CircularModulesPlugin.js +1 -1
  151. package/lib/optimize/ConcatenatedModule.js +2 -6
  152. package/lib/optimize/FlagDependencyExportsPlugin.js +6 -11
  153. package/lib/optimize/FlagDependencyUsagePlugin.js +28 -3
  154. package/lib/optimize/InlineExports.js +4 -7
  155. package/lib/optimize/LazyBarrels.js +41 -5
  156. package/lib/optimize/ModuleConcatenationPlugin.js +8 -10
  157. package/lib/optimize/RealContentHashPlugin.js +2 -6
  158. package/lib/optimize/SideEffectsFlagPlugin.js +7 -21
  159. package/lib/optimize/SplitChunksPlugin.js +11 -24
  160. package/lib/optimize/TupleQueue.js +1 -1
  161. package/lib/output/CleanPlugin.js +3 -1
  162. package/lib/output/CopyPlugin.js +3 -4
  163. package/lib/performance/EvalUsagePlugin.js +1 -3
  164. package/lib/performance/HotspotsPlugin.js +33 -9
  165. package/lib/performance/PureAnnotationsPlugin.js +16 -10
  166. package/lib/performance/TopLevelThisPlugin.js +17 -9
  167. package/lib/prefetch/ResourceHintPlugin.js +1 -1
  168. package/lib/provide/ProvidedDependency.js +36 -4
  169. package/lib/rules/BasicEffectRulePlugin.js +1 -1
  170. package/lib/rules/RuleSetCompiler.js +15 -5
  171. package/lib/rules/UseEffectRulePlugin.js +1 -3
  172. package/lib/runtime/AsyncModuleRuntimeModule.js +7 -1
  173. package/lib/runtime/GetChunkFilenameRuntimeModule.js +1 -5
  174. package/lib/runtime/RuntimeGlobals.js +6 -0
  175. package/lib/runtime/RuntimePlugin.js +2 -0
  176. package/lib/schemes/HttpUriPlugin.js +1 -2
  177. package/lib/schemes/VirtualUrlPlugin.js +3 -1
  178. package/lib/serialization/AggregateErrorSerializer.js +3 -3
  179. package/lib/serialization/BinaryMiddleware.js +4 -1
  180. package/lib/serialization/ErrorObjectSerializer.js +2 -5
  181. package/lib/serialization/ObjectMiddleware.js +17 -15
  182. package/lib/serialization/PlainObjectSerializer.js +3 -7
  183. package/lib/serialization/Serializer.js +21 -11
  184. package/lib/serialization/SerializerMiddleware.js +8 -6
  185. package/lib/stats/DefaultStatsFactoryPlugin.js +35 -35
  186. package/lib/stats/DefaultStatsPresetPlugin.js +2 -6
  187. package/lib/stats/DefaultStatsPrinterPlugin.js +12 -11
  188. package/lib/stats/StatsFactory.js +194 -24
  189. package/lib/stats/StatsPrinter.js +126 -13
  190. package/lib/template/DependencyTemplate.js +1 -1
  191. package/lib/template/RuntimeTemplate.js +13 -32
  192. package/lib/template/Template.js +1 -1
  193. package/lib/util/SourceProcessor.js +98 -15
  194. package/lib/util/WeakTupleMap.js +10 -4
  195. package/lib/util/cleverMerge.js +61 -33
  196. package/lib/util/comparators.js +9 -5
  197. package/lib/util/dataURL.js +2 -0
  198. package/lib/util/deprecation.js +4 -3
  199. package/lib/util/globUtils.js +1 -4
  200. package/lib/util/internalSerializables.js +2 -0
  201. package/lib/util/makeSerializable.js +6 -4
  202. package/lib/util/memoize.js +1 -1
  203. package/lib/util/parseJson.js +2 -2
  204. package/lib/util/serialization.js +31 -27
  205. package/lib/wasm/AsyncWasmModule.js +12 -2
  206. package/lib/wasm/AsyncWebAssemblyGenerator.js +12 -4
  207. package/lib/wasm/AsyncWebAssemblyJavascriptGenerator.js +13 -5
  208. package/lib/wasm/AsyncWebAssemblyParser.js +7 -5
  209. package/lib/wasm/UniversalCompileAsyncWasmPlugin.js +2 -6
  210. package/lib/wasm-sync/SyncWasmModule.js +16 -1
  211. package/lib/wasm-sync/WebAssemblyGenerator.js +15 -10
  212. package/lib/wasm-sync/WebAssemblyJavascriptGenerator.js +13 -5
  213. package/lib/wasm-sync/WebAssemblyParser.js +10 -12
  214. package/lib/web/FetchCompileAsyncWasmPlugin.js +4 -12
  215. package/lib/web/FetchCompileWasmPlugin.js +2 -6
  216. package/package.json +16 -18
  217. package/schemas/WebpackOptions.check.js +3 -3
  218. package/schemas/WebpackOptions.json +2 -2
  219. package/schemas/plugins/BannerPlugin.check.js +3 -3
  220. package/schemas/plugins/HtmlGeneratorOptions.check.js +3 -3
  221. package/schemas/plugins/HtmlParserOptions.check.js +3 -3
  222. package/schemas/plugins/IgnorePlugin.check.js +3 -3
  223. package/schemas/plugins/LoaderOptionsPlugin.check.js +3 -3
  224. package/schemas/plugins/ManifestPlugin.check.js +3 -3
  225. package/schemas/plugins/ProgressPlugin.check.js +3 -3
  226. package/schemas/plugins/SSRManifestPlugin.check.js +3 -3
  227. package/schemas/plugins/SourceMapDevToolPlugin.check.js +3 -3
  228. package/schemas/plugins/WatchIgnorePlugin.check.js +3 -3
  229. package/schemas/plugins/asset/AssetGeneratorOptions.check.js +3 -3
  230. package/schemas/plugins/asset/AssetInlineGeneratorOptions.check.js +3 -3
  231. package/schemas/plugins/asset/AssetParserOptions.check.js +3 -3
  232. package/schemas/plugins/asset/AssetResourceGeneratorOptions.check.js +3 -3
  233. package/schemas/plugins/container/ContainerPlugin.check.js +3 -3
  234. package/schemas/plugins/container/ContainerReferencePlugin.check.js +3 -3
  235. package/schemas/plugins/container/ExternalsType.check.js +3 -3
  236. package/schemas/plugins/container/ModuleFederationPlugin.check.js +3 -3
  237. package/schemas/plugins/css/CssAutoOrModuleParserOptions.check.js +3 -3
  238. package/schemas/plugins/css/CssGeneratorOptions.check.js +3 -3
  239. package/schemas/plugins/css/CssModuleGeneratorOptions.check.js +3 -3
  240. package/schemas/plugins/css/CssModuleParserOptions.check.js +3 -3
  241. package/schemas/plugins/css/CssParserOptions.check.js +3 -3
  242. package/schemas/plugins/debug/ProfilingPlugin.check.js +3 -3
  243. package/schemas/plugins/define/DotenvPluginOptions.check.js +7 -0
  244. package/schemas/plugins/define/DotenvPluginOptions.json +3 -0
  245. package/schemas/plugins/dll/DllPlugin.check.js +3 -3
  246. package/schemas/plugins/dll/DllReferencePlugin.check.js +3 -3
  247. package/schemas/plugins/ids/HashedModuleIdsPlugin.check.js +3 -3
  248. package/schemas/plugins/ids/OccurrenceChunkIdsPlugin.check.js +3 -3
  249. package/schemas/plugins/ids/OccurrenceModuleIdsPlugin.check.js +3 -3
  250. package/schemas/plugins/json/JsonModulesPluginGenerator.check.js +3 -3
  251. package/schemas/plugins/json/JsonModulesPluginParser.check.js +3 -3
  252. package/schemas/plugins/optimize/AggressiveSplittingPlugin.check.js +3 -3
  253. package/schemas/plugins/optimize/LimitChunkCountPlugin.check.js +3 -3
  254. package/schemas/plugins/optimize/MergeDuplicateChunksPlugin.check.js +3 -3
  255. package/schemas/plugins/optimize/MinChunkSizePlugin.check.js +3 -3
  256. package/schemas/plugins/output/CleanOptions.check.js +7 -0
  257. package/schemas/plugins/output/CleanOptions.json +3 -0
  258. package/schemas/plugins/schemes/HttpUriPlugin.check.js +3 -3
  259. package/schemas/plugins/schemes/VirtualUrlPlugin.check.js +3 -3
  260. package/schemas/plugins/sharing/ConsumeSharedPlugin.check.js +3 -3
  261. package/schemas/plugins/sharing/ProvideSharedPlugin.check.js +3 -3
  262. package/schemas/plugins/sharing/SharePlugin.check.js +3 -3
  263. package/types.d.ts +1482 -358
@@ -38,12 +38,7 @@ const { STAGE_DEFAULT } = require("./OptimizationStages");
38
38
  */
39
39
  /** @import ESMExportImportedSpecifierDependency from "../dependencies/esm/ESMExportImportedSpecifierDependency" */
40
40
  /** @import Compiler from "../Compiler" */
41
- /** @import Module, { BuildMeta, BuildInfo } from "../module/Module" */
42
- /**
43
- * @import {
44
- * JavascriptModuleBuildInfo
45
- * } from "../javascript/JavascriptModule"
46
- */
41
+ /** @import Module from "../module/Module" */
47
42
  /** @import ModuleGraphConnection from "../graph/ModuleGraphConnection" */
48
43
  /** @import { ExportInfo, TargetItemWithConnection } from "../graph/ExportsInfo" */
49
44
  /** @import JavascriptParser, { Range } from "../javascript/JavascriptParser" */
@@ -407,7 +402,7 @@ class SideEffectsFlagPlugin {
407
402
  const hasSideEffects = SideEffectsFlagPlugin.moduleHasSideEffects(
408
403
  resolved.relativePath,
409
404
  resolved.sideEffects,
410
- /** @type {CacheItem} */ (cache)
405
+ cache
411
406
  );
412
407
  module.factoryMeta.sideEffectFree = !hasSideEffects;
413
408
  }
@@ -545,16 +540,13 @@ class SideEffectsFlagPlugin {
545
540
  );
546
541
  parser.hooks.finish.tap(PLUGIN_NAME, () => {
547
542
  if (sideEffectsStatement === undefined) {
548
- /** @type {BuildMeta} */
549
- (parser.state.module.buildMeta).sideEffectFree = true;
543
+ parser.state.module.buildMeta.sideEffectFree = true;
550
544
  } else {
551
545
  const type = sideEffectsStatement.type;
552
546
  const loc = parser.getLocation(sideEffectsStatement);
553
547
  const at = formatLocation(loc);
554
548
 
555
- const buildInfo = /** @type {BuildInfo} */ (
556
- parser.state.module.buildInfo
557
- );
549
+ const buildInfo = parser.state.module.buildInfo;
558
550
  recordOptimizationBailout(
559
551
  buildInfo,
560
552
  `Statement (${type}) with side effects in source code at ${at}`
@@ -701,9 +693,7 @@ class SideEffectsFlagPlugin {
701
693
  if (pureFunctions === undefined || pureFunctions.size === 0) {
702
694
  return;
703
695
  }
704
- const buildInfo = /** @type {JavascriptModuleBuildInfo} */ (
705
- parser.state.module.buildInfo
706
- );
696
+ const buildInfo = parser.state.module.buildInfo;
707
697
  if (buildInfo.pureFunctions) {
708
698
  for (const fn of pureFunctions) {
709
699
  buildInfo.pureFunctions.add(fn);
@@ -838,9 +828,7 @@ class SideEffectsFlagPlugin {
838
828
  candidate.connection
839
829
  )) &&
840
830
  (Boolean(dep.name) ||
841
- hasSingleStarReexport(
842
- /** @type {Module} */ (candidate.module)
843
- )),
831
+ hasSingleStarReexport(candidate.module)),
844
832
  ({
845
833
  module: newModule,
846
834
  export: exportName,
@@ -904,9 +892,7 @@ class SideEffectsFlagPlugin {
904
892
  moduleGraph.updateModule(dep, target.module);
905
893
  moduleGraph.updateParent(
906
894
  dep,
907
- /** @type {ModuleGraphConnection} */ (
908
- target.connection
909
- ),
895
+ target.connection,
910
896
  /** @type {Module} */ (connection.originModule)
911
897
  );
912
898
  moduleGraph.addExplanation(
@@ -409,7 +409,7 @@ const mergeSizes = (...sizes) => {
409
409
  * @returns {boolean} true, if there are sizes > 0
410
410
  */
411
411
  const hasNonZeroSizes = (sizes) => {
412
- for (const key of /** @type {SourceType[]} */ (Object.keys(sizes))) {
412
+ for (const key of Object.keys(sizes)) {
413
413
  if (sizes[key] > 0) return true;
414
414
  }
415
415
  return false;
@@ -445,7 +445,7 @@ const combineSizes = (a, b, combine) => {
445
445
  * @returns {boolean} true if there are sizes and all existing sizes are at least `minSize`
446
446
  */
447
447
  const checkMinSize = (sizes, minSize) => {
448
- for (const key of /** @type {SourceType[]} */ (Object.keys(minSize))) {
448
+ for (const key of Object.keys(minSize)) {
449
449
  const size = sizes[key];
450
450
  if (size === undefined || size === 0) continue;
451
451
  if (size < minSize[key]) return false;
@@ -461,9 +461,7 @@ const checkMinSize = (sizes, minSize) => {
461
461
  * @returns {boolean} true if there are sizes and all existing sizes are at least `minSizeReduction`
462
462
  */
463
463
  const checkMinSizeReduction = (sizes, minSizeReduction, chunkCount) => {
464
- for (const key of /** @type {SourceType[]} */ (
465
- Object.keys(minSizeReduction)
466
- )) {
464
+ for (const key of Object.keys(minSizeReduction)) {
467
465
  const size = sizes[key];
468
466
  if (size === undefined || size === 0) continue;
469
467
  if (size * chunkCount < minSizeReduction[key]) return false;
@@ -480,7 +478,7 @@ const checkMinSizeReduction = (sizes, minSizeReduction, chunkCount) => {
480
478
  const getViolatingMinSizes = (sizes, minSize) => {
481
479
  /** @type {SourceTypes | undefined} */
482
480
  let list;
483
- for (const key of /** @type {SourceType[]} */ (Object.keys(minSize))) {
481
+ for (const key of Object.keys(minSize)) {
484
482
  const size = sizes[key];
485
483
  if (size === undefined || size === 0) continue;
486
484
  if (size < minSize[key]) {
@@ -498,7 +496,7 @@ const getViolatingMinSizes = (sizes, minSize) => {
498
496
  */
499
497
  const totalSize = (sizes) => {
500
498
  let size = 0;
501
- for (const key of /** @type {SourceType[]} */ (Object.keys(sizes))) {
499
+ for (const key of Object.keys(sizes)) {
502
500
  size += sizes[key];
503
501
  }
504
502
  return size;
@@ -514,7 +512,7 @@ const normalizeName = (name) => {
514
512
  return () => name;
515
513
  }
516
514
  if (typeof name === "function") {
517
- return /** @type {GetNameFn} */ (name);
515
+ return name;
518
516
  }
519
517
  };
520
518
 
@@ -1222,8 +1220,7 @@ class SplitChunksPlugin {
1222
1220
  const sizeByKey = boundsChunkSetSizes ? new Map() : undefined;
1223
1221
  const groups = boundsChunkSetSizes
1224
1222
  ? /** @type {IntersectionCacheGroup[]} */ (
1225
- /** @type {IntersectionSettings} */ (intersectionSettings)
1226
- .groups
1223
+ intersectionSettings.groups
1227
1224
  )
1228
1225
  : undefined;
1229
1226
  for (const module of compilation.modules) {
@@ -1289,9 +1286,7 @@ class SplitChunksPlugin {
1289
1286
  : undefined;
1290
1287
  const groups = boundsExportsChunkSetSizes
1291
1288
  ? /** @type {IntersectionCacheGroup[]} */ (
1292
- /** @type {IntersectionSettings} */ (
1293
- exportsIntersectionSettings
1294
- ).groups
1289
+ exportsIntersectionSettings.groups
1295
1290
  )
1296
1291
  : undefined;
1297
1292
  for (const module of compilation.modules) {
@@ -2065,11 +2060,7 @@ class SplitChunksPlugin {
2065
2060
  if (count < cacheGroup.minChunks) continue;
2066
2061
  // Select chunks by configuration
2067
2062
  const { chunks: selectedChunks, key: selectedChunksKey } =
2068
- getSelectedChunks(
2069
- chunkCombination,
2070
- /** @type {ChunkFilterFn} */
2071
- (cacheGroup.chunksFilter)
2072
- );
2063
+ getSelectedChunks(chunkCombination, cacheGroup.chunksFilter);
2073
2064
 
2074
2065
  addModuleToChunksInfoMap(
2075
2066
  cacheGroup,
@@ -2265,9 +2256,7 @@ class SplitChunksPlugin {
2265
2256
  limit: byAsyncRequests
2266
2257
  ? "maxAsyncRequests"
2267
2258
  : "maxInitialRequests",
2268
- maxRequests:
2269
- /** @type {number} */
2270
- (maxRequests),
2259
+ maxRequests,
2271
2260
  modules: item.modules.size
2272
2261
  });
2273
2262
  }
@@ -2496,9 +2485,7 @@ class SplitChunksPlugin {
2496
2485
  if (Object.keys(maxSize).length === 0) {
2497
2486
  continue;
2498
2487
  }
2499
- for (const key of /** @type {SourceType[]} */ (
2500
- Object.keys(maxSize)
2501
- )) {
2488
+ for (const key of Object.keys(maxSize)) {
2502
2489
  const maxSizeValue = maxSize[key];
2503
2490
  const minSizeValue = minSize[key];
2504
2491
  if (
@@ -66,7 +66,7 @@ class TupleQueue {
66
66
  }
67
67
  return;
68
68
  }
69
- this._set.delete(.../** @type {[...K, V]} */ (result.value));
69
+ this._set.delete(...result.value);
70
70
  return result.value;
71
71
  }
72
72
  }
@@ -374,7 +374,9 @@ class CleanPlugin {
374
374
  {
375
375
  name: "Clean Plugin",
376
376
  baseDataPath: "options"
377
- }
377
+ },
378
+ (options) =>
379
+ require("../../schemas/plugins/output/CleanOptions.check")(options)
378
380
  );
379
381
  });
380
382
 
@@ -44,7 +44,7 @@ const createCompilationHooks = () => ({
44
44
  /** @import CacheFacade from "../cache/CacheFacade" */
45
45
  /** @import { Snapshot } from "../fs/FileSystemInfo" */
46
46
  /** @import { Logger } from "../logging/Logger" */
47
- /** @import { Dirent, InputFileSystem, IStats } from "../fs/fs" */
47
+ /** @import { Dirent, InputFileSystem, IStats, JsonObject } from "../fs/fs" */
48
48
  /** @import { GlobMatchOptions } from "../util/globUtils" */
49
49
  /** @import { Source } from "webpack-sources" */
50
50
 
@@ -62,7 +62,7 @@ const createCompilationHooks = () => ({
62
62
  * @returns {string | Buffer | Promise<string | Buffer>} content of the asset
63
63
  */
64
64
 
65
- /** @typedef {Record<string, EXPECTED_ANY>} CopyTransformCacheKeys */
65
+ /** @typedef {JsonObject} CopyTransformCacheKeys */
66
66
 
67
67
  /**
68
68
  * @callback CopyTransformCacheKeysFunction
@@ -186,8 +186,7 @@ const mapLimit = (items, limit, fn) =>
186
186
  */
187
187
  const stat = (fs, filePath) =>
188
188
  new Promise((resolve, reject) => {
189
- /** @type {NonNullable<InputFileSystem["stat"]>} */
190
- (fs.stat)(filePath, (err, stats) => {
189
+ fs.stat(filePath, (err, stats) => {
191
190
  if (err) {
192
191
  if (err.code === "ENOENT" || err.code === "ENOTDIR") {
193
192
  return resolve(undefined);
@@ -56,9 +56,7 @@ class EvalUsagePlugin {
56
56
  parser.hooks.call.for("eval").tap(PLUGIN_NAME, () => {
57
57
  // Kept on the module rather than in a map here, so a module the
58
58
  // filesystem cache restores rather than parses still reports.
59
- const buildInfo = /** @type {BuildInfo} */ (
60
- parser.state.module.buildInfo
61
- );
59
+ const buildInfo = parser.state.module.buildInfo;
62
60
 
63
61
  getBuildDiagnostics(buildInfo).usesEval = true;
64
62
  });
@@ -12,6 +12,19 @@ const { compareStrings } = require("../util/comparators");
12
12
  const { contextify } = require("../util/identifier");
13
13
 
14
14
  /** @typedef {import("tapable").FullTap} FullTap */
15
+
16
+ /**
17
+ * The callback an `async` tap reports its error or result through.
18
+ * @template R the hook's result
19
+ * @typedef {(error?: Error | null, result?: R) => void} TapCallback
20
+ */
21
+
22
+ /**
23
+ * An `async` tap's function, the hook's callback after its arguments.
24
+ * @template {unknown[]} A the hook's arguments
25
+ * @template R the hook's result
26
+ * @typedef {(...args: [...A, TapCallback<R>]) => void} AsyncTapFunction
27
+ */
15
28
  /** @typedef {import("../../declarations/WebpackOptions").PerformanceOptions} PerformanceOptions */
16
29
  /** @typedef {import("../Compiler")} Compiler */
17
30
  /** @typedef {import("../Compilation")} Compilation */
@@ -146,15 +159,17 @@ class HotspotsPlugin {
146
159
  return {
147
160
  ...tapInfo,
148
161
  /**
149
- * @param {EXPECTED_ANY[]} args the tap's arguments, callback last
150
- * @returns {EXPECTED_ANY} whatever the tap returned
162
+ * @template {unknown[]} A the hook's arguments
163
+ * @template R the hook's result
164
+ * @param {[...A, TapCallback<R>]} args the tap's arguments, callback last
165
+ * @returns {void}
151
166
  */
152
167
  fn: (...args) => {
153
- const callback = args.pop();
168
+ const callback = /** @type {TapCallback<R>} */ (args.pop());
154
169
 
155
170
  /**
156
- * @param {EXPECTED_ANY[]} result what the tap reported
157
- * @returns {EXPECTED_ANY} whatever the callback returned
171
+ * @param {Parameters<TapCallback<R>>} result what the tap reported
172
+ * @returns {void}
158
173
  */
159
174
  const finish = (...result) =>
160
175
  measure(pluginTime, name, hookName, () => callback(...result));
@@ -162,7 +177,11 @@ class HotspotsPlugin {
162
177
  // The completion callback is the plugin's own code as well, so it
163
178
  // is charged to the plugin rather than to whoever resumed it.
164
179
  return measure(pluginTime, name, hookName, () =>
165
- fn(...args, finish)
180
+ /** @type {AsyncTapFunction<A, R>} */ (fn)(
181
+ // `pop()` took the callback off, which the tuple type cannot follow.
182
+ .../** @type {A} */ (/** @type {unknown[]} */ (args)),
183
+ finish
184
+ )
166
185
  );
167
186
  }
168
187
  };
@@ -171,10 +190,15 @@ class HotspotsPlugin {
171
190
  return {
172
191
  ...tapInfo,
173
192
  /**
174
- * @param {EXPECTED_ANY[]} args the tap's arguments
175
- * @returns {EXPECTED_ANY} whatever the tap returned
193
+ * @template {unknown[]} A the hook's arguments
194
+ * @template R what the tap returns: the hook's result, or a promise of it
195
+ * @param {A} args the tap's arguments
196
+ * @returns {R} whatever the tap returned
176
197
  */
177
- fn: (...args) => measure(pluginTime, name, hookName, () => fn(...args))
198
+ fn: (...args) =>
199
+ measure(pluginTime, name, hookName, () =>
200
+ /** @type {(...args: A) => R} */ (fn)(...args)
201
+ )
178
202
  };
179
203
  };
180
204
 
@@ -22,6 +22,14 @@ const { CompilerHintNotationRegExp } = require("../util/magicComment");
22
22
  /** @import JavascriptParser from "../javascript/JavascriptParser" */
23
23
  /** @import { PureAnnotationDetails } from "../errors/PureAnnotationsWarning" */
24
24
 
25
+ /** @typedef {{ [Key in string]?: AstValue }} AstFields */
26
+ /** @typedef {AstValue[]} AstArray */
27
+ /**
28
+ * A value found while walking an estree AST structurally: a node, a field of
29
+ * one, or a literal's value.
30
+ * @typedef {string | number | boolean | bigint | RegExp | null | undefined | AstArray | AstFields} AstValue
31
+ */
32
+
25
33
  const PLUGIN_NAME = "PureAnnotationsPlugin";
26
34
 
27
35
  // Enough to name the offenders without listing every module.
@@ -46,8 +54,10 @@ const collectStarts = (ast) => {
46
54
  const starts = [];
47
55
  /** @type {Set<number>} */
48
56
  const annotated = new Set();
49
- /** @type {unknown[]} */
50
- const queue = [ast];
57
+ /** @type {AstValue[]} */
58
+ const queue = [
59
+ /** @type {AstValue} */ (/** @type {Program | AstValue} */ (ast))
60
+ ];
51
61
 
52
62
  while (queue.length > 0) {
53
63
  const node = queue.pop();
@@ -55,18 +65,16 @@ const collectStarts = (ast) => {
55
65
  if (!node || typeof node !== "object") continue;
56
66
 
57
67
  if (Array.isArray(node)) {
58
- for (const item of /** @type {unknown[]} */ (node)) queue.push(item);
68
+ for (const item of node) queue.push(item);
59
69
  continue;
60
70
  }
61
71
 
62
72
  // Walked structurally rather than per node type, so a node the estree
63
73
  // types do not name is still reached.
64
- const fields = /** @type {Record<string, unknown>} */ (node);
74
+ const fields = /** @type {AstFields} */ (node);
65
75
  const { type, range } = fields;
66
76
 
67
- const start = Array.isArray(range)
68
- ? /** @type {unknown[]} */ (range)[0]
69
- : undefined;
77
+ const start = Array.isArray(range) ? range[0] : undefined;
70
78
 
71
79
  if (typeof type === "string" && typeof start === "number") {
72
80
  starts.push(start);
@@ -151,9 +159,7 @@ class PureAnnotationsPlugin {
151
159
 
152
160
  // Kept on the module rather than in a map here, so a module the
153
161
  // filesystem cache restores rather than parses still reports.
154
- const buildInfo = /** @type {BuildInfo} */ (
155
- parser.state.module.buildInfo
156
- );
162
+ const buildInfo = parser.state.module.buildInfo;
157
163
 
158
164
  getBuildDiagnostics(buildInfo).ineffectivePureAnnotations = wasted;
159
165
  });
@@ -14,13 +14,21 @@ const {
14
14
  const { getBuildDiagnostics } = require("../util/buildDiagnostics");
15
15
  const { compareStrings } = require("../util/comparators");
16
16
 
17
- /** @import { Expression, PrivateIdentifier, Program } from "estree" */
17
+ /** @import { Program } from "estree" */
18
18
  /** @import { PerformanceOptions } from "../../declarations/WebpackOptions" */
19
19
  /** @import Compiler from "../Compiler" */
20
20
  /** @import Module, { BuildInfo } from "../module/Module" */
21
21
  /** @import JavascriptParser from "../javascript/JavascriptParser" */
22
22
  /** @import { TopLevelThisDetails } from "../errors/TopLevelThisWarning" */
23
23
 
24
+ /** @typedef {{ [Key in string]?: AstValue }} AstFields */
25
+ /** @typedef {AstValue[]} AstArray */
26
+ /**
27
+ * A value found while walking an estree AST structurally: a node, a field of
28
+ * one, or a literal's value.
29
+ * @typedef {string | number | boolean | bigint | RegExp | null | undefined | AstArray | AstFields} AstValue
30
+ */
31
+
24
32
  const PLUGIN_NAME = "TopLevelThisPlugin";
25
33
 
26
34
  // Enough to name the offenders without listing every module.
@@ -41,8 +49,10 @@ const CLASS_TYPES = new Set(["ClassDeclaration", "ClassExpression"]);
41
49
  */
42
50
  const countTopLevelThis = (ast) => {
43
51
  let count = 0;
44
- /** @type {unknown[]} */
45
- const queue = [ast];
52
+ /** @type {AstValue[]} */
53
+ const queue = [
54
+ /** @type {AstValue} */ (/** @type {Program | AstValue} */ (ast))
55
+ ];
46
56
 
47
57
  while (queue.length > 0) {
48
58
  const node = queue.pop();
@@ -50,13 +60,13 @@ const countTopLevelThis = (ast) => {
50
60
  if (!node || typeof node !== "object") continue;
51
61
 
52
62
  if (Array.isArray(node)) {
53
- for (const item of /** @type {unknown[]} */ (node)) queue.push(item);
63
+ for (const item of node) queue.push(item);
54
64
  continue;
55
65
  }
56
66
 
57
67
  // Walked structurally rather than per node type, so a node the estree
58
68
  // types do not name is still reached.
59
- const fields = /** @type {Record<string, unknown>} */ (node);
69
+ const fields = /** @type {AstFields} */ (node);
60
70
  const { type } = fields;
61
71
 
62
72
  if (typeof type !== "string") continue;
@@ -71,7 +81,7 @@ const countTopLevelThis = (ast) => {
71
81
  queue.push(fields.superClass);
72
82
 
73
83
  const body =
74
- /** @type {{ body: { computed?: boolean, key?: Expression | PrivateIdentifier }[] } | null | undefined} */
84
+ /** @type {{ body: { computed?: boolean, key?: AstValue }[] } | null | undefined} */
75
85
  (fields.body);
76
86
 
77
87
  for (const element of (body && body.body) || []) {
@@ -130,9 +140,7 @@ class TopLevelThisPlugin {
130
140
 
131
141
  // Kept on the module rather than in a map here, so a module the
132
142
  // filesystem cache restores rather than parses still reports.
133
- const buildInfo =
134
- /** @type {BuildInfo} */
135
- (parser.state.module.buildInfo);
143
+ const buildInfo = parser.state.module.buildInfo;
136
144
 
137
145
  getBuildDiagnostics(buildInfo).topLevelThis = count;
138
146
  });
@@ -558,7 +558,7 @@ const collectStartupAssetHintLines = (
558
558
  if (urlDep.mediaAttribute) existing.media = urlDep.mediaAttribute;
559
559
  } else {
560
560
  perAsset.set(key, {
561
- assetModule: /** @type {Module} */ (assetModule),
561
+ assetModule,
562
562
  originModule: module,
563
563
  request: dep.request,
564
564
  preload: Boolean(dep.preload),
@@ -5,6 +5,8 @@
5
5
 
6
6
  "use strict";
7
7
 
8
+ const AwaitDependenciesInitFragment = require("../async-modules/AwaitDependenciesInitFragment");
9
+ const isGeneratorLowered = require("../async-modules/isGeneratorLowered");
8
10
  const ModuleDependency = require("../dependencies/core/ModuleDependency");
9
11
  const Dependency = require("../graph/Dependency");
10
12
  const { isInlinedUsedName } = require("../optimize/InlineExports");
@@ -16,6 +18,7 @@ const { propertyAccess } = require("../util/property");
16
18
  /** @import { ReplaceSource } from "webpack-sources" */
17
19
  /**
18
20
  * @import {
21
+ * DependencyKinds,
19
22
  * ReferencedExports,
20
23
  * UpdateHashContext,
21
24
  * ExportInfoName
@@ -103,6 +106,9 @@ class ProvidedDependency extends ModuleDependency {
103
106
  }
104
107
  }
105
108
 
109
+ /** @type {Set<keyof DependencyKinds>} */
110
+ ProvidedDependency.KINDS = new Set([...ModuleDependency.KINDS, "provided"]);
111
+
106
112
  makeSerializable(ProvidedDependency, [
107
113
  "webpack/lib/provide/ProvidedDependency",
108
114
  // TODO in the next major release: remove, they restore pre-move cache packs
@@ -121,6 +127,7 @@ class ProvidedDependencyTemplate extends ModuleDependency.Template {
121
127
  dependency,
122
128
  source,
123
129
  {
130
+ module,
124
131
  runtime,
125
132
  runtimeTemplate,
126
133
  moduleGraph,
@@ -143,24 +150,49 @@ class ProvidedDependencyTemplate extends ModuleDependency.Template {
143
150
  runtimeRequirements
144
151
  });
145
152
 
153
+ // An async module only exposes its exports once awaited, and only an ESM
154
+ // consumer is async itself (see `InferAsyncModulesPlugin`).
155
+ const isAsync =
156
+ moduleGraph.isAsync(connection.module) && moduleGraph.isAsync(module);
157
+ const target = isAsync ? dep.identifier : moduleRaw;
146
158
  const provided = !usedName
147
- ? moduleRaw
159
+ ? target
148
160
  : isInlinedUsedName(usedName)
149
- ? `(${moduleRaw}, ${usedName.render(
161
+ ? `(${target}, ${usedName.render(
150
162
  Template.toNormalComment(
151
163
  `inlined export ${propertyAccess(dep.ids)}`
152
164
  )
153
165
  )})`
154
- : `${moduleRaw}${propertyAccess(/** @type {string[]} */ (usedName), 0)}`;
166
+ : `${target}${propertyAccess(/** @type {string[]} */ (usedName), 0)}`;
155
167
 
156
168
  initFragments.push(
157
169
  new InitFragment(
158
- `/* provided dependency */ var ${dep.identifier} = ${provided};\n`,
170
+ `/* provided dependency */ var ${dep.identifier} = ${
171
+ isAsync ? moduleRaw : provided
172
+ };\n`,
159
173
  InitFragment.STAGE_PROVIDES,
160
174
  1,
161
175
  `provided ${dep.identifier}`
162
176
  )
163
177
  );
178
+ if (isAsync) {
179
+ initFragments.push(
180
+ new AwaitDependenciesInitFragment(
181
+ new Map([[dep.identifier, dep.identifier]]),
182
+ isGeneratorLowered(module, moduleGraph, runtimeTemplate)
183
+ )
184
+ );
185
+ if (provided !== target) {
186
+ initFragments.push(
187
+ new InitFragment(
188
+ `${dep.identifier} = ${provided};\n`,
189
+ InitFragment.STAGE_ASYNC_ESM_IMPORTS,
190
+ 1,
191
+ `provided async ${dep.identifier}`
192
+ )
193
+ );
194
+ }
195
+ }
164
196
  source.replace(dep.range[0], dep.range[1] - 1, dep.identifier);
165
197
  }
166
198
  }
@@ -15,7 +15,7 @@
15
15
  * @typedef {import("./RuleSetCompiler").KeysOfTypes<T, V>} KeysOfTypes
16
16
  */
17
17
 
18
- /** @typedef {KeysOfTypes<RuleSetRule, string | boolean | { [k: string]: EXPECTED_ANY }>} BasicEffectRuleKeys */
18
+ /** @typedef {KeysOfTypes<RuleSetRule, string | boolean | EXPECTED_OBJECT>} BasicEffectRuleKeys */
19
19
 
20
20
  const PLUGIN_NAME = "BasicEffectRulePlugin";
21
21
 
@@ -13,6 +13,7 @@ const {
13
13
  } = require("../util/identifier");
14
14
 
15
15
  /** @import { ResolveRequest } from "enhanced-resolve" */
16
+ /** @import { JsonValue } from "../fs/fs" */
16
17
  /**
17
18
  * @import {
18
19
  * Falsy,
@@ -84,7 +85,7 @@ const {
84
85
  * Defines the effect use type used by this module.
85
86
  * @typedef {object} EffectUse
86
87
  * @property {EffectUseType} type
87
- * @property {{ loader: string, options?: string | null | Record<string, EXPECTED_ANY>, ident?: string }} value
88
+ * @property {{ loader: string, options?: RuleSetLoaderOptions | null, ident?: string }} value
88
89
  */
89
90
 
90
91
  /**
@@ -164,7 +165,7 @@ class RuleSetCompiler {
164
165
  for (const condition of rule.conditions) {
165
166
  const p = condition.property;
166
167
  if (Array.isArray(p)) {
167
- /** @type {EXPECTED_ANY} */
168
+ /** @type {EffectData | EffectData[keyof EffectData] | JsonValue} */
168
169
  let current = data;
169
170
  for (const subProperty of p) {
170
171
  if (
@@ -172,14 +173,22 @@ class RuleSetCompiler {
172
173
  typeof current === "object" &&
173
174
  Object.prototype.hasOwnProperty.call(current, subProperty)
174
175
  ) {
175
- current = current[/** @type {keyof EffectData} */ (subProperty)];
176
+ current = /** @type {Record<string, JsonValue>} */ (current)[
177
+ subProperty
178
+ ];
176
179
  } else {
177
180
  current = undefined;
178
181
  break;
179
182
  }
180
183
  }
181
184
  if (current !== undefined) {
182
- if (!condition.fn(current)) return false;
185
+ if (
186
+ !condition.fn(
187
+ /** @type {EffectData[keyof EffectData]} */ (current)
188
+ )
189
+ ) {
190
+ return false;
191
+ }
183
192
  continue;
184
193
  }
185
194
  } else if (p in data) {
@@ -526,8 +535,9 @@ class RuleSetCompiler {
526
535
 
527
536
  /**
528
537
  * Returns an error object.
538
+ * @template T
529
539
  * @param {string} path current path
530
- * @param {EXPECTED_ANY} value value at the error location
540
+ * @param {T} value value at the error location
531
541
  * @param {string} message message explaining the problem
532
542
  * @returns {Error} an error object
533
543
  */
@@ -173,9 +173,7 @@ class UseEffectRulePlugin {
173
173
  );
174
174
  });
175
175
  }
176
- return [
177
- useToEffect(path, path, /** @type {RuleSetUseItem} */ (items))
178
- ];
176
+ return [useToEffect(path, path, items)];
179
177
  };
180
178
 
181
179
  if (typeof use === "function") {
@@ -9,6 +9,7 @@ const HelperRuntimeModule = require("./HelperRuntimeModule");
9
9
  const RuntimeGlobals = require("./RuntimeGlobals");
10
10
 
11
11
  /** @import Compilation from "../Compilation" */
12
+ /** @import Chunk from "../graph/Chunk" */
12
13
 
13
14
  class AsyncModuleRuntimeModule extends HelperRuntimeModule {
14
15
  /**
@@ -32,6 +33,11 @@ class AsyncModuleRuntimeModule extends HelperRuntimeModule {
32
33
  const { runtimeTemplate } = compilation;
33
34
  const fn = RuntimeGlobals.asyncModule;
34
35
  const defer = this._deferInterop;
36
+ const exposeExports =
37
+ defer ||
38
+ compilation.chunkGraph
39
+ .getTreeRuntimeRequirements(/** @type {Chunk} */ (this.chunk))
40
+ .has(RuntimeGlobals.asyncModuleExportSymbol);
35
41
  const strictErrors = this._strictModuleErrorHandling;
36
42
  const moduleCache = this.receivesHotUpdates()
37
43
  ? RuntimeGlobals.moduleCache
@@ -54,7 +60,7 @@ class AsyncModuleRuntimeModule extends HelperRuntimeModule {
54
60
  : [`${cst} hasSymbol = typeof Symbol === "function";`]),
55
61
  `${cst} webpackQueues = ${renderSymbol("webpack queues", "__webpack_queues__")};`,
56
62
  `${cst} webpackExports = ${
57
- defer ? `${RuntimeGlobals.asyncModuleExportSymbol}= ` : ""
63
+ exposeExports ? `${RuntimeGlobals.asyncModuleExportSymbol}= ` : ""
58
64
  }${renderSymbol("webpack exports", RuntimeGlobals.exports)};`,
59
65
  `${cst} webpackError = ${renderSymbol("webpack error", "__webpack_error__")};`,
60
66
  ...(strictErrors ? [`${cst} cycleGroups = {};`] : []),