@module-federation/runtime-core 0.0.0-next-20250920011011 → 0.0.0-next-20250922150632

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.
@@ -202,7 +202,7 @@ function getGlobalFederationConstructor() {
202
202
  function setGlobalFederationConstructor(FederationConstructor, isDebug = sdk.isDebugMode()) {
203
203
  if (isDebug) {
204
204
  CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
205
- CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.0.0-next-20250920011011";
205
+ CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.0.0-next-20250922150632";
206
206
  }
207
207
  }
208
208
  // eslint-disable-next-line @typescript-eslint/ban-types
@@ -1191,7 +1191,7 @@ function getRemoteEntryUniqueKey(remoteInfo) {
1191
1191
  return sdk.composeKeyWithSeparator(name, entry);
1192
1192
  }
1193
1193
  async function getRemoteEntry(params) {
1194
- const { origin, remoteEntryExports, remoteInfo, getEntryUrl } = params;
1194
+ const { origin, remoteEntryExports, remoteInfo, getEntryUrl, _inErrorHandling = false } = params;
1195
1195
  const uniqueKey = getRemoteEntryUniqueKey(remoteInfo);
1196
1196
  if (remoteEntryExports) {
1197
1197
  return remoteEntryExports;
@@ -1218,6 +1218,28 @@ async function getRemoteEntry(params) {
1218
1218
  remoteInfo,
1219
1219
  loaderHook
1220
1220
  });
1221
+ }).catch(async (err)=>{
1222
+ const uniqueKey = getRemoteEntryUniqueKey(remoteInfo);
1223
+ const isScriptLoadError = err instanceof Error && err.message.includes(errorCodes.RUNTIME_008);
1224
+ if (isScriptLoadError && !_inErrorHandling) {
1225
+ const wrappedGetRemoteEntry = (params)=>{
1226
+ return getRemoteEntry(polyfills._extends({}, params, {
1227
+ _inErrorHandling: true
1228
+ }));
1229
+ };
1230
+ const RemoteEntryExports = await origin.loaderHook.lifecycle.loadEntryError.emit({
1231
+ getRemoteEntry: wrappedGetRemoteEntry,
1232
+ origin,
1233
+ remoteInfo: remoteInfo,
1234
+ remoteEntryExports,
1235
+ globalLoading,
1236
+ uniqueKey
1237
+ });
1238
+ if (RemoteEntryExports) {
1239
+ return RemoteEntryExports;
1240
+ }
1241
+ }
1242
+ throw err;
1221
1243
  });
1222
1244
  }
1223
1245
  return globalLoading[uniqueKey];
@@ -1433,26 +1455,11 @@ let Module = class Module {
1433
1455
  return this.remoteEntryExports;
1434
1456
  }
1435
1457
  let remoteEntryExports;
1436
- try {
1437
- remoteEntryExports = await getRemoteEntry({
1438
- origin: this.host,
1439
- remoteInfo: this.remoteInfo,
1440
- remoteEntryExports: this.remoteEntryExports
1441
- });
1442
- } catch (err) {
1443
- const uniqueKey = getRemoteEntryUniqueKey(this.remoteInfo);
1444
- const isScriptLoadError = err instanceof Error && err.message.includes(errorCodes.RUNTIME_008);
1445
- if (isScriptLoadError) {
1446
- remoteEntryExports = await this.host.loaderHook.lifecycle.loadEntryError.emit({
1447
- getRemoteEntry,
1448
- origin: this.host,
1449
- remoteInfo: this.remoteInfo,
1450
- remoteEntryExports: this.remoteEntryExports,
1451
- globalLoading,
1452
- uniqueKey
1453
- });
1454
- }
1455
- }
1458
+ remoteEntryExports = await getRemoteEntry({
1459
+ origin: this.host,
1460
+ remoteInfo: this.remoteInfo,
1461
+ remoteEntryExports: this.remoteEntryExports
1462
+ });
1456
1463
  assert(remoteEntryExports, `remoteEntryExports is undefined \n ${sdk.safeToString(this.remoteInfo)}`);
1457
1464
  this.remoteEntryExports = remoteEntryExports;
1458
1465
  return this.remoteEntryExports;
@@ -3043,7 +3050,7 @@ class ModuleFederation {
3043
3050
  // maybe will change, temporarily for internal use only
3044
3051
  initContainer: new AsyncWaterfallHook('initContainer')
3045
3052
  });
3046
- this.version = "0.0.0-next-20250920011011";
3053
+ this.version = "0.0.0-next-20250922150632";
3047
3054
  this.moduleCache = new Map();
3048
3055
  this.loaderHook = new PluginSystem({
3049
3056
  // FIXME: may not be suitable , not open to the public yet