Skip to content

Commit

Permalink
fix(angular): support serving static remotes using tuple API #12658 (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Coly010 committed Oct 19, 2022
1 parent 96dd780 commit d6285a5
Showing 1 changed file with 7 additions and 2 deletions.
Expand Up @@ -12,6 +12,7 @@ import { join } from 'path';
import { executeWebpackDevServerBuilder } from '../webpack-dev-server/webpack-dev-server.impl';
import { existsSync, readFileSync } from 'fs';
import { readProjectsConfigurationFromProjectGraph } from 'nx/src/project-graph/project-graph';
import { MFRemotes } from '../../utils/mf/with-module-federation';

function getDynamicRemotes(
project: ProjectConfiguration,
Expand Down Expand Up @@ -84,7 +85,7 @@ function getStaticRemotes(
'module-federation.config.js'
);

let mfeConfig: { remotes: string[] };
let mfeConfig: { remotes: MFRemotes };
try {
mfeConfig = require(mfConfigPath);
} catch {
Expand All @@ -93,7 +94,11 @@ function getStaticRemotes(
);
}

const staticRemotes = mfeConfig.remotes.length > 0 ? mfeConfig.remotes : [];
const remotesConfig = mfeConfig.remotes.length > 0 ? mfeConfig.remotes : [];
const staticRemotes = remotesConfig.map((remoteDefinition) =>
Array.isArray(remoteDefinition) ? remoteDefinition[0] : remoteDefinition
);

const invalidStaticRemotes = staticRemotes.filter(
(remote) => !workspaceProjects[remote]
);
Expand Down

0 comments on commit d6285a5

Please sign in to comment.