Framework Compatibility
- single-spa:
single-spais also framework-agnostic, allowing you to integrate applications built with different frameworks into a single micro frontend architecture. - @angular-architects/module-federation:
@angular-architects/module-federationis specifically designed for Angular applications, providing seamless integration with Angular CLI and Angular's module system. - @module-federation/nextjs-mf:
@module-federation/nextjs-mfis tailored for Next.js applications, leveraging Next.js features like server-side rendering and static site generation while implementing Module Federation. - import-map-overrides:
import-map-overridesis framework-agnostic and can be used with any JavaScript application that supports import maps, making it versatile for various projects.
Code Sharing
- single-spa:
single-spasupports code sharing between micro frontends by allowing them to register shared dependencies, ensuring that shared libraries are loaded only once. - @angular-architects/module-federation:
@angular-architects/module-federationenables code sharing between Angular applications by configuring shared modules and components in the Webpack configuration. - @module-federation/nextjs-mf:
@module-federation/nextjs-mffacilitates code sharing between Next.js applications using Module Federation, allowing you to share components and utilities across different Next.js projects. - import-map-overrides:
import-map-overridesallows for dynamic code sharing by modifying the import map at runtime, enabling you to override module paths and share code as needed.
Dynamic Imports
- single-spa:
single-spasupports dynamic imports of micro frontends, allowing them to load and unload as needed based on the application's routing and state. - @angular-architects/module-federation:
@angular-architects/module-federationsupports dynamic imports of Angular modules, allowing you to load modules on demand and reduce the initial bundle size. - @module-federation/nextjs-mf:
@module-federation/nextjs-mfsupports dynamic imports of Next.js components and modules, enabling on-demand loading and improving performance. - import-map-overrides:
import-map-overridesenhances dynamic imports by allowing you to override module paths at runtime, making it easier to test and develop with different module versions.
Routing and Navigation
- single-spa:
single-spaprovides a robust routing system for micro frontends, allowing you to define routes for each micro frontend and manage navigation between them. - @angular-architects/module-federation:
@angular-architects/module-federationintegrates with Angular's routing system, allowing you to define routes for federated modules and navigate between them seamlessly. - @module-federation/nextjs-mf:
@module-federation/nextjs-mfworks with Next.js routing, allowing you to define routes for federated components and navigate between them while leveraging Next.js's built-in routing features. - import-map-overrides:
import-map-overridesdoes not handle routing directly, but it can be used alongside any routing solution to dynamically override module imports based on the current route or application state.
Ease of Use: Code Examples
- single-spa:
Single SPA Example
import { registerApplication, start } from 'single-spa'; registerApplication( 'app1', () => import('http://localhost:3001/app1.js'), (location) => location.pathname.startsWith('/app1') ); registerApplication( 'app2', () => import('http://localhost:3002/app2.js'), (location) => location.pathname.startsWith('/app2') ); start(); - @angular-architects/module-federation:
Angular Module Federation Example
// webpack.config.js const ModuleFederationPlugin = require('webpack/lib/container/ModuleFederationPlugin'); module.exports = { plugins: [ new ModuleFederationPlugin({ name: 'app1', filename: 'remoteEntry.js', exposes: { './Component': './src/app/component/component.ts', }, shared: { angular: { singleton: true } }, }), ], }; - @module-federation/nextjs-mf:
Next.js Module Federation Example
// next.config.js const { ModuleFederationPlugin } = require('webpack').container; module.exports = { webpack: (config) => { config.plugins.push( new ModuleFederationPlugin({ name: 'app2', filename: 'remoteEntry.js', remotes: { app1: 'app1@http://localhost:3001/remoteEntry.js', }, shared: { react: { singleton: true }, 'react-dom': { singleton: true } }, }) ); return config; }, }; - import-map-overrides:
Import Map Overrides Example
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Import Map Overrides</title> <script type="importmap"> { "imports": { "lodash": "https://cdn.jsdelivr.net/npm/lodash@4.17.21/lodash.js" } } </script> <script src="https://unpkg.com/import-map-overrides"></script> <script> // Override the lodash import importMapOverrides.setOverrides({ "lodash": "https://cdn.jsdelivr.net/npm/lodash@4.17.21/lodash.js" }); import('lodash').then((_) => { console.log(_.VERSION); }); </script> </head> <body> </body> </html>

