Related to the following issue: module-federation/core#2371.
The monorepo contains 3 applications:
- An host application
- A remote module named remote-1
- A remote module named remote-2
First install the dependencies with PNPM:
pnpm install
Then, start the solution by executing the following command at the root of the workspace:
pnpm dev
You should that the application cannot render because an error has been thrown:
Error
[ Federation Runtime ]: [ Federation Runtime ]: Error thrown from the beforeRequest hook.
Even if there's an errorLoadRemote
hook configured for the host application:
export default function () {
return {
name: "custom-runtime-plugin",
async beforeRequest(args) {
console.log("*********beforeRequest", args);
throw new Error("Error thrown from the beforeRequest hook.");
return args;
},
async errorLoadRemote(args) {
console.log("*********errorLoadRemote", args);
}
}
}