Link to the code that reproduces this issue
https://github.com/igz0/nextjs-sitemap-conflict-turbopack
To Reproduce
-
Create a fresh Next.js v15.3.1 project with the App Router.
-
Add src/app/sitemap.ts:
// generates /sitemap.xml
import type { MetadataRoute } from 'next'
export default function sitemap(): MetadataRoute.Sitemap {
return [
{
url: 'https://example.com',
},
]
}
- Add src/app/sitemap/page.tsx:
// renders /sitemap
export default function SitemapPage() {
return <div>Sitemap</div>
}
- Start dev server with Turbopack (default in next dev):
pnpm dev # or npm run dev / yarn dev
- Observe the console error and that the dev server refuses to compile.
Error: ./src/app
An issue occurred while preparing your Next.js app
Conflicting page and metadata at /sitemap: page at /sitemap/page and metadata at /sitemap/route
Current vs. Expected behavior
| |
Current (bug) |
Expected |
| Dev with Turbopack |
❌ Fails at startup with conflict error |
✅ Should allow both routes:• /sitemap.xml from sitemap.ts• /sitemap from sitemap/page.tsx |
| Dev with --no-turbo (webpack) |
✅ Works |
✅ |
| next build / production |
✅ Builds |
✅ |
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 24.4.0: Fri Apr 11 18:32:50 PDT 2025; root:xnu-11417.101.15~117/RELEASE_ARM64_T6041
Available memory (MB): 49152
Available CPU cores: 12
Binaries:
Node: 20.15.1
npm: 10.7.0
Yarn: 1.22.19
pnpm: N/A
Relevant Packages:
next: 15.4.0-canary.12 // Latest available version is detected (15.4.0-canary.12).
eslint-config-next: N/A
react: 19.1.0
react-dom: 19.1.0
typescript: 5.8.3
Next.js Config:
output: N/A
Which area(s) are affected? (Select all that apply)
Turbopack
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
- Happens only when Turbopack is enabled; next dev --no-turbo compiles fine.
- Removing either file or renaming one of the routes avoids the error.
- According to the docs, metadata routes such as src/app/sitemap.ts should map to /sitemap.xml, which should not collide with a page at /sitemap.
- The conflict check therefore looks Turbopack-specific.
Link to the code that reproduces this issue
https://github.com/igz0/nextjs-sitemap-conflict-turbopack
To Reproduce
Create a fresh Next.js v15.3.1 project with the App Router.
Add src/app/sitemap.ts:
pnpm dev # or npm run dev / yarn devCurrent vs. Expected behavior
Provide environment information
Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 24.4.0: Fri Apr 11 18:32:50 PDT 2025; root:xnu-11417.101.15~117/RELEASE_ARM64_T6041 Available memory (MB): 49152 Available CPU cores: 12 Binaries: Node: 20.15.1 npm: 10.7.0 Yarn: 1.22.19 pnpm: N/A Relevant Packages: next: 15.4.0-canary.12 // Latest available version is detected (15.4.0-canary.12). eslint-config-next: N/A react: 19.1.0 react-dom: 19.1.0 typescript: 5.8.3 Next.js Config: output: N/AWhich area(s) are affected? (Select all that apply)
Turbopack
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context