| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Speed up the your micro-frontend development. Configure less and delivery more. You don't need to waste more time trying to change your application to support multiple micro-frontends or use iframe becase of old bundler version.
Reason One Webpack federation module and other bundlers requires newest version of their library (webpack 5+) and makes your application bounded to their architecture, which makes harder the migration to other module bundles.
Reason Two If your project uses old bundler version like <= webpack4, you might not be able to use a decent configuration to run a micro-frontend in the client side without spending some time changing the architecture of your container and host.
Reason Three If you don't want to spend too much time chaing the architecture of your container and host, you might decide to go with iframe which is not good for the following reasons:
Configuring your container It's pretty straight forward, you just need to call the Micro component in your container, which is in most of the case the root application:
import { Micro } from "react-micro-js";
<Micro
name="MicroCar"
manifestSRC="manifest.json"
host="http://localhost:4000"
deeps={[...]}
/>where:
The manifest is json file which has a files entry on it. If you use create-react-app it will be something like:
Configuring your host There's one last step, which is to configure your micro-frontend, some times called as host.
In the entry point of your application, most of the time index.js, you need to move your ReactDOM render logic to be inside a function, like this example bellow:
const mountFn = (connect) => (containerId, deeps) => {
const root = ReactDOM.createRoot(document.getElementById(containerId));
root.render(<App />);
connect(root);
};Please notice we're calling a connect function which will come as parameter from the connector later. Also notice this 2 parameters provided in the curried function: containerId and deeps, where:
Then, you just need to provide your mountFn to react-micro-js connector and that is it:
import { connector } from "react-micro-js";
const host = connector(mountFn, {
devRoot: "root",
name: "MicroCar",
});Where:
We're more than happy to fix bugs, create features or help you anything, you just need to create an issue here.
| Back | FazBrowse Home | New Git URL |