#Route Path in `createFileRoute` Keeps Auto-Correcting to Remove Layout Folder

5 messages · Page 1 of 1 (latest)

lean lintel
#

Hi all,
I’m running into an issue with TanStack Router’s file-based routing. My file structure is:

src/routes/
  _authenticated.tsx
  _authenticated.create-log.tsx
  _authenticated.index.tsx

In _authenticated.create-log.tsx, I set up the route like this:

export const Route = createFileRoute('/_authenticated/create-log')({
  // code here
})

But whenever I save the file, the path in createFileRoute automatically changes to:

createFileRoute('/create-log')

This causes a TypeScript error:

Argument of type '"/create-log"' is not assignable to parameter of type 'keyof FileRoutesByPath | undefined'.

It seems like some tool or extension is auto-correcting the route path and removing the _authenticated part, even though I want to keep the file path for type safety.

Has anyone else run into this? Is there a way to prevent this auto-correction or configure it to keep the full file path?

Thanks!

rose nymph
#

our vite plugin automatically sets that path

#

this cannot be turned off and is necessary

#

can you please provide a complete minimal example that reproduces this error?