I am trying to expose component or module as remote using module federation plugin but facing below error.
container entry:AppComponent[0] - Error: Module not found: Error: Can't resolve './src/app/app.component.ts' in '/src/main/webapp'
Please find below webpack.config.js configuration.
const ModuleFederationPlugin = require('webpack/lib/container/ModuleFederationPlugin');
const mf = require('@angular-architects/module-federation/webpack');
const path = require('path');
const share = mf.share;
const sharedMappings = new mf.SharedMappings();
sharedMappings.register(path.join(__dirname, '../../tsconfig.json'), [
/* mapped paths to share */
]);
module.exports = {
output: {
uniqueName: 'myApp',
publicPath: 'auto',
scriptType: 'text/javascript'
},
optimization: {
runtimeChunk: false
},
resolve: {
alias: {
...sharedMappings.getAliases()
},
},
plugins: [
new ModuleFederationPlugin({
name: "my_app",
filename: "my_app.js",
exposes: {
"AppComponent": './src/app/app.component.ts'
},
shared: share({
'@angular/core': { singleton: true, strictVersion: true, requiredVersion: '12.2.17' },
'@angular/common': { singleton: true, strictVersion: true, requiredVersion: '12.2.17' },
'@angular/router': { singleton: true, strictVersion: true, requiredVersion: '12.2.17' },
...sharedMappings.getDescriptors()
})
}),
sharedMappings.getPlugin()
]
};