@@ -13,7 +13,7 @@ const Template = require("../Template");
1313const HarmonyExportImportedSpecifierDependency = require ( "../dependencies/HarmonyExportImportedSpecifierDependency" ) ;
1414const ConcatenatedModule = require ( "../optimize/ConcatenatedModule" ) ;
1515const propertyAccess = require ( "../util/propertyAccess" ) ;
16- const { getEntryRuntime } = require ( "../util/runtime" ) ;
16+ const { getEntryRuntime, getRuntimeKey } = require ( "../util/runtime" ) ;
1717const AbstractLibraryPlugin = require ( "./AbstractLibraryPlugin" ) ;
1818
1919/** @typedef {import("webpack-sources").Source } Source */
@@ -92,8 +92,9 @@ class ModuleLibraryPlugin extends AbstractLibraryPlugin {
9292 ( buildMeta . exportsFinalNameByRuntime = new Map ( ) ) ;
9393
9494 for ( const runtime of runtimes ) {
95- exportsSourceByRuntime . set ( runtime , source ) ;
96- exportsFinalNameByRuntime . set ( runtime , finalName ) ;
95+ const key = getRuntimeKey ( runtime ) ;
96+ exportsSourceByRuntime . set ( key , source ) ;
97+ exportsFinalNameByRuntime . set ( key , finalName ) ;
9798 }
9899
99100 return true ;
@@ -277,7 +278,9 @@ class ModuleLibraryPlugin extends AbstractLibraryPlugin {
277278 const exportsFinalNameByRuntime =
278279 ( module . buildMeta &&
279280 module . buildMeta . exportsFinalNameByRuntime &&
280- module . buildMeta . exportsFinalNameByRuntime . get ( chunk . runtime ) ) ||
281+ module . buildMeta . exportsFinalNameByRuntime . get (
282+ getRuntimeKey ( chunk . runtime )
283+ ) ) ||
281284 { } ;
282285
283286 const definitions =
@@ -421,9 +424,10 @@ class ModuleLibraryPlugin extends AbstractLibraryPlugin {
421424 const exportsSource =
422425 module . buildMeta &&
423426 module . buildMeta . exportsSourceByRuntime &&
424- module . buildMeta . exportsSourceByRuntime . get ( chunk . runtime ) ;
427+ module . buildMeta . exportsSourceByRuntime . get ( getRuntimeKey ( chunk . runtime ) ) ;
425428
426- // Re-add the module's exports source when rendered in factory or as an inlined startup module wrapped in an IIFE
429+ // Re-add the module's exports source when rendered in factory
430+ // or as an inlined startup module wrapped in an IIFE
427431 if ( ( inlinedInIIFE || factory ) && exportsSource ) {
428432 return new ConcatSource ( exportsSource , source ) ;
429433 }
0 commit comments