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 the migration I'd use for a host that currently imports analytics/UsageMeter. The widget takes plain props and renders a progress indicator. That gives us an easy way to check the migration before moving anything that depends on auth or routing.

1. Move the exposed UI into a separate remote build

List the old plugin's exposes, the host's import('remote/...') calls, and the shared modules behind those imports. Start with a client component. If the old remote was a Next.js app, extract the exposed component into a Vite remote. The Next.js app can keep serving the routes it owns. If the old expose was a full page, decide which piece of UI to extract and which app should own its URL.

For this example, put the component in src/UsageMeter.tsx and default-export a component with an amount: number prop. In your Vite 8 project, add @next-federation/vite and @next-federation/server, pin React and React DOM to the same React 19 version, and use this remote config:

// analytics-remote/vite.config.ts import { defineConfig } from 'vite' import { nextFederationComponents } from '@next-federation/vite' export default defineConfig({ plugins: [ nextFederationComponents({ name: 'analytics', base: 'http://127.0.0.1:4110/', exposes: { './UsageMeter': './src/UsageMeter.tsx' }, }), ], }) 

Remove the scaffold's React Fast Refresh plugin from the remote config. Run vite build and serve the output with nf-serve --dir dist --port 4110, using your package runner. Check that http://127.0.0.1:4110/_nf/components.json responds. For a staging deployment, build with the deployed remote origin in base. If the component needs its remote team's backend credentials or server-side rendering logic, look at a Next Federation island as a separate migration path. Vite remote guide · Island guide

2. Switch the host integration on an existing Pages Router route

Use a staging copy of the host for the cutover. This walkthrough targets Next.js 16 with React 19. The documented Next Federation host range is >=15.5.28 <17, so an app on Next 14 needs a Next.js upgrade as part of the cutover. If the old plugin supplied several remotes, prepare replacements for the ones the host still needs before removing its config.

Remove NextFederationPlugin, NEXT_PRIVATE_LOCAL_WEBPACK, and the old plugin's chunk-flushing and revalidation calls. Uninstall @module-federation/nextjs-mf. Install @next-federation/core, @next-federation/next, and @next-federation/react. Wrap the existing Next config with withNextFederation() from @next-federation/next/config. Then register the remote origin:

// lib/federation.config.ts import { defineFederation } from '@next-federation/core' export const federation = defineFederation({ remotes: { analytics: { origin: 'http://127.0.0.1:4110' }, }, }) 

Replace the old import('analytics/UsageMeter') path. Here's the Pages Router version with the wrapper inline for clarity:

// pages/usage.tsx import type { InferGetServerSidePropsType } from 'next' import { createRemoteComponent } from '@next-federation/next/pages/components' import { getComponentDescriptor } from '@next-federation/next/pages/server' import { federation } from '../lib/federation.config' const UsageMeter = createRemoteComponent<{ amount: number }>({ expose: './UsageMeter', fallback: <p>Loading usage…</p>, errorFallback: <p>Usage is temporarily unavailable.</p>, }) export async function getServerSideProps() { const descriptor = await getComponentDescriptor(federation, 'analytics') return { props: { descriptor } } } export default function UsagePage( { descriptor }: InferGetServerSidePropsType<typeof getServerSideProps>, ) { return <UsageMeter descriptor={descriptor} amount={42} /> } 

If the route already uses getStaticProps, fetch and pass the descriptor there. The existing route should work with the new remote before you change routers. Pages Router wiring

3. Render the same remote from an App Router page

Create an App Router wrapper with the same expose and props, using the App Router entry point:

// lib/usage-meter.tsx 'use client' import { createRemoteComponent } from '@next-federation/next/components' export const UsageMeter = createRemoteComponent<{ amount: number }>({ expose: './UsageMeter', fallback: <p>Loading usage…</p>, errorFallback: <p>Usage is temporarily unavailable.</p>, }) 

Set up the App Router root layout if this is your first app/ route. Add a test route with its own URL, such as app/usage-preview/page.tsx. Here the async Server Component fetches the descriptor.

// app/usage-preview/page.tsx import { getComponentDescriptor } from '@next-federation/next/server' import { federation } from '../../lib/federation.config' import { UsageMeter } from '../../lib/usage-meter' export default async function UsagePreview() { const descriptor = await getComponentDescriptor(federation, 'analytics') return <UsageMeter descriptor={descriptor} amount={42} /> } 

Both routes can now consume the same remote build. During a mixed-router migration, keep the correct wrapper for each route and register any shared context modules in each router that uses them. Expect a full page load when navigating between the routers. If the remote imports next/router, replace those calls with a supported navigation API or pass the required route data as props before moving it to the App Router. Mixed-router hosts · Remote links and routing

4. Check loading, SSR, and a remote-only release

  • Open both routes and verify the meter renders with the expected props. For App Router routes using Cache Components, follow the host guide's Suspense setup.
  • Rebuild the remote with a visible change and verify that the host picks it up after descriptor revalidation. Keep the old build assets available if cached HTML or open tabs still point to them.
  • Test the loading and error fallbacks. In a fresh staging host without a previously verified descriptor, point the remote at an unavailable endpoint and verify that the rest of the page still works.
  • If the old page needs the widget in its initial HTML, configure SSR verification. Sign the remote build and add its public key to the host. The unsigned example in this article loads in the browser when policy permits. Test the server-rendered page with JavaScript disabled.

Once the preview route passes those checks, move the intended URL to app/ and remove its old pages/ entry in the same change. The remote can keep the same build and its own deployment pipeline.

You can see both router adapters in the repo's examples before moving a route in your application. If you try the migration and hit an expose that depends heavily on Next.js internals, I'd like to hear what it does. Run the examples · Full migration guide · GitHub repository