Dev.Lib
arrow_backBack to Blogs
LEVEL_1010.3June 27, 20261 min read

Module federation

Frontend Architecture

Webpack/Vite federation — runtime share of remote modules across apps (`remoteEntry.js`).

Summary

Webpack/Vite federation — runtime share of remote modules across apps (remoteEntry.js). Shared dependency versioning (singleton React) critical. Enables independent deploy; adds network/runtime coupling. Fallback when remote down — error boundaries and cached builds.

Code example

// Host app webpack.config.js concept
/*
new ModuleFederationPlugin({
  name: 'shell',
  remotes: { shop: 'shop@https://cdn.example.com/remoteEntry.js' },
  shared: { react: { singleton: true, requiredVersion: '^18.0.0' } },
});
*/
const Shop = React.lazy(() => import('shop/ProductPage'));

Key points

  • Webpack/Vite federation — runtime share of remote modules across apps (remoteEntry.js).
  • Shared dependency versioning (singleton React) critical.
  • Enables independent deploy; adds network/runtime coupling.
  • Fallback when remote down — error boundaries and cached builds.

Further reading

Related concepts