How to migrate from nextjs-mf to the Next.js App Router
If @module-federation/nextjs-mf is the reason your app is still on the Pages Router, you can move the federation integration first and move routes afterward. I built Next Federation to make that possible. It supports both Next.js routers with Turbopack or webpack on the host. The old plugin's docs mark the integration as deprecated and list Pages Router support. Upstream integration docs Here's…
To move from the Next.js Monorepo Federation to the Next.js App Router, begin by isolating the UI components and moving them to remote build servers. Use the old plugin's exposes to list the exposed UI, its imports, and the shared modules. Create a Vite remote project and list the remote UI component with its amount prop. Configure the remote in vite.config.ts with the base URL and exposes.
Remove React Fast Refresh from the remote config and serve the output. Test that the remote responds correctly using nf-serve. Next, update the host integration on an existing Pages Router route within a staging environment. This requires upgrading to Next.js 16 with React 19 and preparing replacements for any remaining remotes.
Then, replace the old import path with the createRemoteComponent wrapper. This allows the route to render the remote component with loading and error fallbacks. Finally, create an App Router wrapper for the same remote component, maintaining the same expose and props. This ensures the remote component can be rendered from an App Router page, preserving functionality while transitioning to the new router architecture.
Rewritten by urgent.news; may contain errors — check the original.
Source: dev.to