Skip to content

Commit

Permalink
fix(react): Update error message for invalid remote name
Browse files Browse the repository at this point in the history
  • Loading branch information
ndcunningham committed Oct 19, 2023
1 parent e887671 commit 9d32017
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
9 changes: 8 additions & 1 deletion packages/angular/src/utils/mf/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,14 @@ export function getFunctionDeterminateRemoteUrl(isServer: boolean = false) {
const remoteEntry = isServer ? 'server/remoteEntry.js' : 'remoteEntry.mjs';

return function (remote: string) {
const remoteConfiguration = readCachedProjectConfiguration(remote);
let remoteConfiguration = null;
try {
remoteConfiguration = readCachedProjectConfiguration(remote);
} catch (e) {
throw new Error(
`Cannot find project "${remote}". Check that the name is correct in module-federation config file.\n`
);
}
const serveTarget = remoteConfiguration?.targets?.[target];

if (!serveTarget) {
Expand Down
9 changes: 8 additions & 1 deletion packages/react/src/module-federation/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,14 @@ export function getFunctionDeterminateRemoteUrl(isServer: boolean = false) {
const remoteEntry = isServer ? 'server/remoteEntry.js' : 'remoteEntry.js';

return function (remote: string) {
const remoteConfiguration = readCachedProjectConfiguration(remote);
let remoteConfiguration = null;
try {
remoteConfiguration = readCachedProjectConfiguration(remote);
} catch (e) {
throw new Error(
`Cannot find project "${remote}". Check that the name is correct in module-federation config file.\n`
);
}
const serveTarget = remoteConfiguration?.targets?.[target];

if (!serveTarget) {
Expand Down

0 comments on commit 9d32017

Please sign in to comment.