angularwebpack-module-federationangular-module-federation

Angular Module Federation. Uncaught (in promise): TypeError: container.init is not a function


I created two angular module federation apps using angular module federation plugin but faced with an error Uncaught (in promise): TypeError: container.init is not a function after I load the remote component error image link

I found this github issue thread with the solution to add scriptType: 'text/javascript' in output section of webpack.config.js file but it does not work for me.

If you need more details about apps here are links for host and remote repositories.

@angular/cli version is 13.0.2

@angular-architects/module-federation version is 14.2.3.

Thanks.


Solution

  • Made module federation work for the Angular standalone project.

    Just installed Webpack 5.72.0 as a dev dependency.

    Webpack was not listed in the dependencies of package.json and I took a look at its version via the node_modules folder, it was 5.64.0.