Skip to content

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

@igz0

Description

@igz0

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    TurbopackRelated to Turbopack with Next.js.linear: turbopackConfirmed issue that is tracked by the Turbopack team.

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions