中文 | English
A micro-frontend demo project using Webpack 5 Module Federation, showcasing cross-framework integration with React 18, React 16, and Vue 3.
- 🚀 Module Federation - Runtime dynamic loading of remote modules
- 🎯 Cross-Framework - React 18 + React 16 + Vue 3 integration
- 🔄 Real-time State Sync - Cross-framework state synchronization
- 📦 Independent Deployment - Each micro-frontend can be deployed independently
- 🛡️ Type Safety - Full TypeScript support
- ⚡ Hot Module Replacement - Fast development experience
┌─────────────────────────────────────────┐
│ Host Application │
│ (React 18 + TypeScript) │
│ │
│ ┌─────────────┐ ┌──────────────┐ │
│ │ Products │ │ Cart │ │
│ │ (React 16) │ │ (Vue 3) │ │
│ │ │ │ │ │
│ │ - Redux │ │ - Pinia │ │
│ │ - Remote │ │ - Remote │ │
│ └─────────────┘ └──────────────┘ │
│ │
│ Module Federation │
└─────────────────────────────────────────┘
module-federation-demo/
├── packages/
│ ├── host/ # Host app (React 18 + TypeScript)
│ ├── products/ # Products app (React 16 + JavaScript)
│ ├── cart/ # Cart app (Vue 3 + TypeScript)
│ └── shared/ # Shared types and components
└── README.md # This file
- Node.js >= 16.0.0
- npm >= 8.0.0
# Install all dependencies
npm install# Start all micro-frontends
npm run devThis will start:
- Host: http://localhost:4000
- Products: http://localhost:3001
- Cart: http://localhost:3002
- Open http://localhost:4000
- Navigate to "Products" page
- Click "Add to Cart" on any product
- Watch the cart count update in real-time in the navigation bar ✨
- Click "Cart" to view your shopping cart
Click the badge above to try it out instantly in your browser!
- React 18.3.1 + TypeScript
- React Router 6.20.1
- Zustand (State Management)
- Tailwind CSS
- Webpack 5 Module Federation
- React 16.14.0 + JavaScript
- Redux (State Management)
- Webpack 5 Module Federation
- Vue 3.5.28 + TypeScript
- Pinia (State Management)
- Composition API
- Webpack 5 Module Federation
This project uses multiple branches for different purposes:
main- Main development branchdemo/stackblitz- StackBlitz online demo
# Build all applications
npm run buildWebpack 5's Module Federation allows multiple separate builds to form a single application. Each micro-frontend can be developed and deployed independently.
This project demonstrates real-time state synchronization between React (Zustand) and Vue (Pinia) using:
- localStorage as the data layer
- Custom events for same-tab synchronization
- Storage events for cross-tab synchronization
Want to learn how this works in detail? Stay tuned for the upcoming course! 🎓
Contributions are welcome! Please feel free to submit a Pull Request.
MIT
Brook (@paduma)
- Webpack Module Federation team
- React and Vue communities
- All contributors
Last Updated: 2026-03-22
Status: ✅ Demo Ready | 🎓 Educational Purpose