Master
Languages & Frameworks

Webpack 5 Module Federation

Published: Apr 13, 2021
Apr 2021
Assess?

The release of the Webpack 5 Module Federation feature has been highly anticipated by developers of micro frontend architectures. The feature introduces a more standardized way to optimize how module dependencies and shared code are managed and loaded. Module federation allows for the specification of shared modules, which helps with the deduplication of dependencies across micro frontends by loading code used by multiple modules only once. It also lets you distinguish between local and remote modules, where the remote modules are not actually part of the build itself but loaded asynchronously. Compared to build-time dependencies like npm packages, this can significantly simplify the deployment of a module update with many downstream dependencies. Be aware, though, that this requires you to bundle all of your micro frontends with Webpack, as opposed to approaches such as import maps, which might eventually become part of the W3C standard.