Module federation in NextJS depends on @module-federation/nextjs-mf.
Use Case: Use
NextJSas Host App and Remote app will be a flavour ofReact + Webpack 5.
There are 2 applications,
host-app: NextJS Appremote-app: flavour ofReact + Webpack 5
remote-app is exposing a component called Button and the same button is consumed by host-app.
- run
npm install- Install all the dependencies to run the apps in parallel. - run
npm run install:apps- Install all the required dependencies on bothhost-appandremote-app - run
npm run start- Start bothhost-appandremote-app host-apponlocalhost:3000remote-apponlocalhost:3001- Navigate to
localhost:3000- Two Button Component should be visible, one from remote and another from host app.