Module Federation is an architectural pattern for the decentralization of JavaScript applications (similar to microservices on the server-side). It allows you to share code and resources among multiple JavaScript applications (or micro-frontends). This can help you:
Module Federation 2.0
differs from the Module Federation
built into Webpack5
by providing not only the core features of module export, loading, and dependency sharing but also additional dynamic type hinting, Manifest
, Federation Runtime
, and Runtime Plugin System
. These features make Module Federation
more suitable for use as a micro-frontend architecture in large-scale Web
applications.
Module Federation has the following features:
⚡ Code sharing、Dependency reuse
📝 Manifest
Module Federation is suitable for the following scenarios:
Module Federation is a new feature introduced in Webpack 5, but its history dates back to 2017. At that time, the Webpack team began exploring a way to share code between multiple applications.
In 2018, Webpack 4.20 was released, introducing module hooks, which laid the foundation for the development of Module Federation.
In 2019, Webpack 5 was released, officially introducing the Module Federation feature.
Module Federation has become a powerful tool for building modern web applications.
Module Federation aims to become an architectural method for building large web applications, similar to microservices in the backend. Module Federation will provide more capabilities to meet the foundational needs of large web application decentralization, currently including these parts:
You might want to: