MFE app:
WebpackConfig
new ModuleFederationPlugin({
name: 'remoteApp',
filename: 'remoteEntry.js',
exposes: {
'./App': 'singleSpaEntry',
},
shared: [
{
...pkg.dependencies,
react: {
singleton: true,
requiredVersion: pkg.dependencies.react,
},
'react-dom': {
singleton: true,
requiredVersion: pkg.dependencies['react-dom'],
},
},
],
}),
=========================================================================
WebpackConfig for Host contains :
remotes: {
"remoteApp": 'remoteApp@http://localhost:8081/remoteEntry.js'
}
Declare the module in decl.d.ts as
declare module 'remoteApp/App';
in app.routes.ts:
{
path: 'remotePath', loadChildren: () => import('remoteApp/App').then(m => m.App)
}
Getting this error in browser console:
TypeError: Failed to resolve module specifier “remoteApp@http://localhost:8081/remoteEntry.js”. Relative references must start with either “/”, “./”, or “../”.
2