Seamlessly using Webpack Module Federation with the Angular CLI.
Big thanks to the following people who helped to make this possible:
- Tobias Koppers, Founder of Webpack
- Dmitriy Shekhovtsov, Angular GDE
- Angular CLI 11 (currently BETA)
ng add @angular-architects/module-federation- Adjust the generated
webpack.config.jsfile - Repeat this for further projects in your workspace (if needed)
-
You need to use yarn b/c it allows to override dependencies
- Existing Projects:
ng config -g cli.packageManager yarn - New Projects:
ng new workspace-name --packageManager yarn
- Existing Projects:
-
Add this to your
package.json(e. g. before thedependenciessection) to force the CLI into webpack 5:"resolutions": { "webpack": "5.0.0" },
-
Run yarn to install all packages
See https://github.com/manfredsteyer/module-federation-plugin-example
Have a look at this article series about Module Federation