Skip to content

notFoundComponent defined in __root not rendered when using nitro@3.0.1-alpha.1 #5877

@theoludwig

Description

@theoludwig

Which project does this relate to?

Start

Describe the bug

The notFoundComponent defined in src/routes/__root.tsx is not rendered when using nitro@3.0.1-alpha.1, but it does work if we're not using the nitro/vite plugin.

Instead of displaying the notFoundComponent, it displays:

Image
// vite.config.ts
import { nitro } from "nitro/vite"

export default defineConfig({
  plugins: [
    nitro(),
    tanstackStart(),
    // ...
  ],
})

However, if we don't use the nitro() plugin, it works, and correctly display notFoundComponent:

Image
// vite.config.ts
export default defineConfig({
  plugins: [
    tanstackStart(),
    // ...
  ],
})

Your Example Website or App

https://github.com/theoludwig/tanstack-repro-not-found

Steps to Reproduce the Bug or Issue

  1. git clone git@github.com:theoludwig/tanstack-repro-not-found.git (project created with pnpm create tanstack-app@latest)
  2. cd tanstack-repro-not-found
  3. pnpm install --frozen-lockfile
  4. node --run dev
  5. Go http://localhost:3000/abc for example, it should shows the issue and display: Cannot GET /abc. (404 not working as expected)
  6. Edit vite.config.ts to remove the nitro() plugin, refresh the page http://localhost:3000/abc, and the 404 should work correctly.

Expected behavior

The notFoundComponent defined in src/routes/__root.tsx should be used even when using the nitro v3 plugin.

Screenshots or Videos

No response

Platform

  • Router / Start Version: v132
  • Bundler: vite

Additional context

I don't know if this is a Nitro issue or a TanStack Router/Start issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions