DEV Community

Discussion on: Simplify your monorepo with npm 7 workspaces

Collapse
 
blowsie profile image
Sam Blowes

Doesnt module federation seem like re-inventing the wheel when we already have ESM?

Vite and Snowpack are already using the ESM approach, I wonder how long WebPack will hold the throne.

Collapse
 
michalzalecki profile image
Michal Zalecki

They allow you to manage and share code on different levels. Workspaces are for monorepo, you create and import packages as ESM modules. Integration happens in build time with the ability to import modules dynamically, but you need to build the entire app with dynamic imports.

The benefits of module federation are in the runtime e.g. you can update and deploy only a part of your application (e.g. one monorepo package) owned by a separate team. Workspaces and federated modules can work together.