How diego-rm-dev/vite-plugin-federation works
Project Type and Purpose
• The project is a front-end micro-frontend architecture built with React and Vite.
• It uses Module Federation to dynamically load remote components into a host application.
• The host consumes remote modules from two separate microservices (acting as remotes), each configured to expose specific components (in this case, the "App" components).
Identifying Main Components
• Host Application:
• Resides in the "host" directory.
• Configured on port 3000.
• Uses the federation plugin to declare remotes ("remote1" and "remote2") with their respective endpoints.
• Microservice-1:
• Found in the "microservice-1" directory.
• Configured on port 3001.
• Exposes its App component via Module Federation.
• Microservice-2:
• Found in the "microservice-2" directory.
• Configured on port 3002.
• Similarly exposes its App component.
Highlighting Architectural Patterns and Technologies
• That the architecture follows a micro-frontend approach enabled by Module Federation.
• That the Vite build system is used for configuration and bundling in all modules.
• Mention that the use of React (with dynamic imports using lazy and Suspense) is a critical part of rendering remote components.
• That each application has its own Vite configuration file that sets up the Module Federation (noting the usage of the @module-federation/vite plugin).