Skip to content

Commit

Permalink
feat(mf-runtime): load remotes in parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
manfredsteyer committed Jun 4, 2022
1 parent 623837c commit 5615917
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions libs/mf-runtime/src/lib/loader/dynamic-federation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,14 +233,18 @@ function parseConfig(config: DynamicMfConfigFile): ParsedMfConfigFile {
}

async function loadRemoteEntries() {
const promises: Promise<void>[] = [];

for (let key in config) {
const entry = config[key];

if (entry.type === 'module') {
await loadRemoteEntry({ type: 'module', remoteEntry: entry.remoteEntry });
promises.push(loadRemoteEntry({ type: 'module', remoteEntry: entry.remoteEntry }));
}
else {
await loadRemoteEntry({ type: 'script', remoteEntry: entry.remoteEntry, remoteName: key });
promises.push(loadRemoteEntry({ type: 'script', remoteEntry: entry.remoteEntry, remoteName: key }));
}
}

await Promise.all(promises);
}
1 change: 1 addition & 0 deletions libs/mf/src/utils/share-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ export function share(shareObjects: Config, packageJsonPath = ''): Config {

return result;
}

function addSecondaries(secondaries: Record<string, SharedConfig>, result: {}) {
for (const key in secondaries) {
result[key] = secondaries[key];
Expand Down

0 comments on commit 5615917

Please sign in to comment.