Skip to content

Conflicting page & metadata at /sitemap when Turbopack is enabled (src/app/sitemap.ts vs src/app/sitemap/page.tsx) #78609

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
igz0 opened this issue Apr 28, 2025 · 0 comments
Labels
linear: turbopack Confirmed issue that is tracked by the Turbopack team. Turbopack Related to Turbopack with Next.js.

Comments

@igz0
Copy link

igz0 commented Apr 28, 2025

Link to the code that reproduces this issue

https://github.com/igz0/nextjs-sitemap-conflict-turbopack

To Reproduce

  1. Create a fresh Next.js v15.3.1 project with the App Router.

  2. Add src/app/sitemap.ts:

// generates /sitemap.xml
import type { MetadataRoute } from 'next'

export default function sitemap(): MetadataRoute.Sitemap {
  return [
    {
      url: 'https://example.com',
    },
  ]
}
  1. Add src/app/sitemap/page.tsx:
// renders /sitemap
export default function SitemapPage() {
  return <div>Sitemap</div>
}
  1. Start dev server with Turbopack (default in next dev):
pnpm dev          # or npm run dev / yarn dev
  1. 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.
@github-actions github-actions bot added the Turbopack Related to Turbopack with Next.js. label Apr 28, 2025
@mischnic mischnic added the linear: turbopack Confirmed issue that is tracked by the Turbopack team. label Apr 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
linear: turbopack Confirmed issue that is tracked by the Turbopack team. Turbopack Related to Turbopack with Next.js.
Projects
None yet
Development

No branches or pull requests

2 participants