This example shows how to handle independent and nested routings in a MFE setup based on webpack-module-federation. The setup consists of:
-
dashboard,auth, andshell -
Apps using a browser history strategy when acting as hosts and an in-memory history strategy when acting as remotes.
-
shell: host app based on a browser history strategy that handles high-level routing -
shellrouting determines mounting/unmounting ofdashboardandauthremotes.
The shell is the only component responsible for updating browser url. The two level of history strategies (browser + in-memory) are kept in sync through an event-based communication between shell and remotes.
- Postinstall: Check the gitmodules (submodule update if needed).
- Install deps:
npm install. - Start apps:
npm run start.
Visit http://localhost:8080 to navigate shell app. dashboard and auth are also exposed as standalone apps at http://localhost:8081 and http://localhost:8082 respectively.
The setup is inspired to https://github.com/StephenGrider/mfe and https://github.com/module-federation/module-federation-examples/tree/master/react-nested-routers.