Member-only story

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…

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Zack Jackson
Zack Jackson

Written by Zack Jackson

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

Responses (6)

Write a response

Great write up Zack! 🤘🏽

Hi Zack,
Nice article, the container/host has a webpack config containing the application that are available for loading. Is it possible to override the webpack config and load the appropriate urls or bundle by calling an API ?
Thanks
Jason

Hi, Jack!
Great work always!
I'm Jonghun Park, a front-end developer at Korean FE Article Team.
I enjoyed this article very much so that I'd love to translate the article into Korean and introduce your work to Korean folks via Korean FE Article mailing…

Recommended from Medium

Lists

See more recommendations