Skip to content

Monorepo only: Routes starting with "_" always 404 (eg. /_hello) #6242

@oztune

Description

@oztune

Which project does this relate to?

Start

Describe the bug

Note

This one was a doozy to recreate because it only happens when the Tanstack Start app is inside of a monorepo.

I need to create the route http://localhost:3000/_hello. I have the following setup:

my-monorepo/
  packages/
    [...]
  apps/
    my-app
      src/
        routes/
          __root.tsx
          [_]hello.tsx

Where [_]hello.tsx looks like this:

import { createFileRoute } from '@tanstack/react-router'

export const Route = createFileRoute('/_hello')({
	server: {
		handlers: {
			GET: async () => {
				return Response.json({ hello: 'world' })
			},
		},
	},
})

But when I visit http://localhost:3000/_hello I get a 404 page.


When I create a fresh Tanstack Start app this problem goes away. But as soon as I place it inside of a monorepo it comes back. I only tested this with a pnpm monorepo.

Your Example Website or App

https://github.com/oztune/tanstack-start-bug

Steps to Reproduce the Bug or Issue

  1. Set up a monorepo (doesn't happen in a single repo). I tested this with a pnpm monorepo.
  2. Create a fresh Tanstack Start project from template
  3. Create any route that start with an escaped underscore [_]anything.tsx
  4. Visit that route in the browser (http://localhost:3000/_anything)
  5. You always get 404

Expected behavior

I expect http://localhost:3000/_anything to serve the route

Screenshots or Videos

No response

Platform

MacOS 15.6.1
Any browser

"@tanstack/react-devtools": "^0.7.0",
"@tanstack/react-router": "^1.141.8",
"@tanstack/react-router-devtools": "^1.141.8",
"@tanstack/react-router-ssr-query": "^1.141.8",
"@tanstack/react-start": "^1.141.8",
"@tanstack/router-plugin": "^1.141.8",
"@tanstack/zod-adapter": "^1.142.8",
"nitro": "latest",
"react": "^19.2.1",
"react-dom": "^19.2.1",
"vite-tsconfig-paths": "^5.1.4",
"zod": "^4.2.1"

Additional context

No response

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