Skip to content

Commit

Permalink
fix(angular): remote failing to serve should fail host serve (#10181)
Browse files Browse the repository at this point in the history
  • Loading branch information
Coly010 committed May 9, 2022
1 parent cce5bfe commit 38345da
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
Expand Up @@ -40,15 +40,10 @@ export function moduleFederationDevServer(
? options.devRemotes
: [options.devRemotes];

const remotePorts: number[] = [];
for (const remote of remotes) {
const isDev = devServeRemotes.includes(remote);
const target = isDev ? 'serve' : 'serve-static';

remotePorts.push(
workspaceConfig.projects[remote]?.targets[target]?.options.port ?? 4200
);

scheduleTarget(
context.workspaceRoot,
{
Expand All @@ -59,7 +54,13 @@ export function moduleFederationDevServer(
executor: context.builder.builderName,
},
options.verbose
);
).then((obs) => {
obs.toPromise().catch((err) => {
throw new Error(
`Remote '${remote}' failed to serve correctly due to the following: \r\n${err.toString()}`
);
});
});
}

return webpackServer(options, context);
Expand Down
Expand Up @@ -133,7 +133,11 @@ export default async function* fileServerExecutor(
execFileSync(pmCmd, args, {
stdio: [0, 1, 2],
});
} catch {}
} catch {
throw new Error(
"Project failed to build. Check the build's error output for more information."
);
}
running = false;
}
};
Expand Down

0 comments on commit 38345da

Please sign in to comment.