Urgent.News

What's breaking now, across hundreds of outlets.

Tech

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

Read the original at dev.to →

More from Dev.to on urgent.news

Get the news by email. Yesterday's most-covered stories, every morning.

See today's edition · More options

More in Tech

Your Agent Isn't Bad at Tools. Your Tool Descriptions Are.

Your Agent Isn't Bad at Tools. Your Tool Descriptions Are. Every vendor demo shows an agent gliding through tool calls like it was born to it.

  • Agent's performance depends on tool descriptions, not model intelligence
  • Detailed descriptions critical for tool selection accuracy
  • Validation gate essential between model output and system systems

What is Next Federation, and when is it worth using?

I built Next Federation for Next.js teams that want to deploy part of a page on its own schedule. A Next.js app hosts the page. A separately deployed app provides a piece of UI.

  • Next Federation allows separate UI deployments in Next.js apps.
  • Supports both App Router and Pages Router with Turbopack or webpack.
  • Simplifies integration, but adds runtime composition complexity.

More from Saturday, 5 December 2026 →