When should you leverage Module Federation, and how?

Zack Jackson
11 min readFeb 2, 2022

Critical thinking and patterns on when, why, where, to leverage Module Federation from the creator of the technology.

Webpack’s Federation is immensely useful if used properly.

The tricky part is there's not much information on how and where to leverage the technology. Leading to a bit of a wild west scenario. I've been working with the technology for almost 2 years now, in that time — I've uncovered a handful of patterns and considerations that should be taken into account when developing applications at scale.

For this article, I am only going to focus on Module Federation in the frontend. Getting into federated backends is a whole other story.

Module Federation

When to use it?

The primary use case for federation would be an uncoordinated distribution of software at runtime. There are a couple of categories that can fit nicely into Module Federation.

Global Components like Header or Footer are great first candidates as they are usually unanimous across an application, relatively self-contained, and ideally need to remain consistent across all applications. Updating your Header, publishing it to NPM, then turning around and installing it into 5–10–15 separate applications, and deploying them gets…

--

--

Zack Jackson

Infra Architect @ ByteDance. Creator of Module Federation. Specializing in Bundler and Javascript Orchestration at scale.