I have the following issue, briefly described in the below image:
The shell appolication has 2 mfe's as follows (
module-federation.config.js
):const ModuleFederationPlugin = require('webpack/lib/container/ModuleFederationPlugin'); module.exports = { name: 'shell', remotes: ['mfe1', 'mfe2'], plugins: [...], };
The mfe's are loaded into different
div
s in the shell's screen, on the root route (app.routes.ts
):export const appRoutes: Route[] = [ { path: '', outlet: 'mfe1', loadChildren: () => import('mfe1/Module').then(m => m.RemoteEntryModule), }, { path: '', outlet: 'mfe2', loadChildren: () => import('mfe2/Module').then(m => m.RemoteEntryModule), }, ];
mfe1
, configured to be served throughhttp://localhost:4201
in its'project.json
, has a nested lazy-loaded route within it's tree. The route is defaultly loaded withredirectTo
, although, the problem persists also without theredirectTo
part. (mfe-nested-module.routes.ts
):export const mfe1Routes: Route[] = [ { path: '', component: Mfe1MainPage, children: [ { path: 'nested-route', loadChildren: () => import('./modules/nested/nested.module').then( m => m.NestedModule ), }, { path: '', redirectTo: '/nested-route', pathMatch: 'full', }, ], }, ];
...mfe1 shows the page as expected when accessing it through the reomote port (4201), same goes with mfe2, but the shell tries to load the remote nested module (NestedModule) from the wrong port.
What am I doing wrong?
Thanks!