Problem
Running next dev in a Turbo monorepo with Vercel microfrontends crashes immediately:
Error [MicrofrontendsError]: Found multiple `microfrontends.json` files in the
repository referencing the application "web", but only one is allowed.
/my-project/microfrontends.json
• /my-project/apps/docs/microfrontends.json
This happens when a microfrontends.json exists at the monorepo root and a second copy exists inside an app directory (e.g., apps/docs/microfrontends.json), both referencing the same application name.
Solution
- Find all
microfrontends.jsonfiles in your repo:
find . -name "microfrontends.json" -not -path "*/node_modules/*"
- Keep only the root-level
microfrontends.jsonand consolidate all application entries into it:
{
"$schema": "https://openapi.vercel.sh/microfrontends.json",
"applications": {
"web": {
"development": {
"fallback": "https://web.vercel.app"
}
},
"docs": {
"routing": [{ "paths": ["/docs/:path*"] }],
"development": {
"fallback": "https://docs.vercel.app"
}
}
}
}
- Delete the duplicate files from subdirectories:
rm apps/docs/microfrontends.json
Why It Works
Vercel's @vercel/microfrontends package discovers configuration by walking the repository tree upward from the application directory. When two microfrontends.json files reference the same application name, the system cannot determine which is authoritative. Unlike vercel.json (which can exist per-project), microfrontends.json is strictly one-per-repository because it defines the routing topology for the entire application group.
Context
- Vercel Microfrontends with
@vercel/microfrontendspackage - Next.js 14+ with
withMicrofrontends()innext.config.ts - Commonly occurs in Turborepo monorepos when scaffolding a new app copies config from an existing one
- The
$schemafield enables autocomplete in VS Code and validates against the official schema