From 4715b91b92e0f3b9d513afef54de5f3f65ad3f2f Mon Sep 17 00:00:00 2001 From: Chris Kruining Date: Wed, 21 Aug 2024 14:34:50 +0200 Subject: [PATCH] Update init-federation.ts simplify the code a tad --- .../native-federation-runtime/src/lib/init-federation.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/libs/native-federation-runtime/src/lib/init-federation.ts b/libs/native-federation-runtime/src/lib/init-federation.ts index b58c159f..66dbcc5f 100644 --- a/libs/native-federation-runtime/src/lib/init-federation.ts +++ b/libs/native-federation-runtime/src/lib/init-federation.ts @@ -34,14 +34,13 @@ async function loadManifest(remotes: string): Promise> { async function processRemoteInfos( remotes: Record ): Promise { - const processRemoteInfoPromises = Object.keys(remotes).map( - async (remoteName) => { + const processRemoteInfoPromises = Object.entries(remotes).map( + async ([ name, url ]) => { try { - const url = remotes[remoteName]; - return await processRemoteInfo(url, remoteName); + return await processRemoteInfo(url, name); } catch (e) { console.error( - `Error loading remote entry for ${remoteName} from file ${remotes[remoteName]}` + `Error loading remote entry for ${name} from file ${url}` ); return null; }