react-microfrontend-tool
v1.1.3
Published
react-microfrontend-tool
Maintainers
Keywords
Readme
react-microfrontend-tool
Description
react-microfrontend-tool is a powerful command-line tool that helps you set up a micro frontend architecture using Webpack/Vite Module Federation with React. It automates the initial project setup, allowing you to focus on building your application.
Features
- Latest React Version: Always uses the latest version of React.
- Optimized Folder Structure: Project structure based on best practices.
- Webpack Setup: Automatic Webpack/Vite configuration for development and production builds.
Installation
Global Installation
Install the CLI tool globally using npm:
npm install -g react-microfrontend-toolLocal Installation
Alternatively, you can install it locally within your project:
npm install --save-dev react-microfrontend-toolUsage
After installing the tool, you can use it to set up a micro frontend architecture using Webpack Module Federation with React.
Create a New Micro Frontend
create-microfrontend create The CLI will prompt you for several configuration options:
- Host Application: Enter the name of your Host application.
- Remote Application: Enter the name of your Remote application.
- Number of Remote: Enter the number of your Remote application.
- Bundle tool: Select the bundle tool.
Example
create-microfrontend createSample Prompt Flow:
? Enter the name of your Host application:
? Enter the name of your Remote application:
? Enter the count of microfrontends to add (1-10):
? Select the Bundle tool:This will create host & requested no. of remote applications.
Example
create-microfrontend add-remote-to-hostSample Prompt Flow:
? Enter the count of microfrontends to add (1-10):This will add requested no. of remote applications with existing remotes.
Run the Project
Once the project is scaffolded, navigate into the host & remote directories:
You can now run the development server using:
npm startBuild the Project
To create a production build, run:
npm run buildLocal Development
To work on the CLI tool itself:
Clone the repository:
git clone https://github.com/chetan2012/microfrontend-cli.gitInstall dependencies:
cd microfrontend-cli npm installTest the CLI locally:
npm linkNow you can use the CLI locally for development:
create-microfrontend create create-microfrontend add-remote-to-host
License
This project is licensed under the ISC License. See the [LICENSE] file for details.
