I was following this tutorial , and tried to share a library between the shell and the mfe1 app. I created the lib outside the workspace directory with one service injected in root, then added it to the tutorial package.json, and imported it in both shell and mfe1. Inside both projects webpack config, i added the following configuration
new ModuleFederationPlugin({
.....
},
shared: {
.....
"my-lib": { singleton: true, strictVersion: true, requiredVersion: '1.0.0'},
...sharedMappings.getDescriptors()
}
}),
When testing the shell, i noticed that the singleton service is being initiated twice, first time when loading the shell, second time when moving to the mfe1, maybe i'm missing something, but isn't the purpose of singleton: true
config is to insure that only one instance of that service is existing?