Description
We get the following error message after updating to Angular 15
@angular-architects/module-federation version is 15.0.2
[error] TypeError: Cannot read properties of undefined (reading 'import')
at .\node_modules@angular-architects\module-federation\src\utils\modify-entry-plugin.js:18:120
at mergeEntry (.\node_modules@angular-architects\module-federation\src\utils\modify-entry-plugin.js:11:17)
at cfgOrRemove (.\node_modules@angular-architects\module-federation\src\utils\modify-entry-plugin.js:14:28)
at .\node_modules@angular-architects\module-federation\src\utils\modify-entry-plugin.js:18:75
at Array.forEach ()
at ModifyEntryPlugin.apply (.\node_modules@angular-architects\module-federation\src\utils\modify-entry-plugin.js:17:34)
at createCompiler (.\node_modules\webpack\lib\webpack.js:73:12)
at create (.\node_modules\webpack\lib\webpack.js:134:16)
at webpack (.\node_modules\webpack\lib\webpack.js:158:32)
at Object.f [as webpackFactory] (.\node_modules\webpack\lib\index.js:64:16)
I was also able to reproduce that error message in the tutorial project with the following steps:
- After cloning the starter kit update the project via
ng update
- Adding module federation via
ng add @angular-architects/module-federation
to shell and remote - add
eager: true
to shareAll configuration in shell project - run
ng serve shell
The error only occurs when eager is set to true in shareAll configuration
webpack.config.js shell
const { shareAll, withModuleFederationPlugin } = require('@angular-architects/module-federation/webpack');
module.exports = withModuleFederationPlugin({
shared: {
...shareAll({ singleton: true, eager: true, strictVersion: true, requiredVersion: 'auto' }),
},
});