Skip to content

Vite Plugin not re-generating routes with a non-standard Vite root configured #1550

@a-maas

Description

@a-maas

Describe the bug

I've provided minimal example project that demonstrates a potential bug with the TanStack Router Vite Plugin not detecting and generating when using a non-standard vite root configuration. In this example, the vite root config is set to app in the vite.config.ts file. With this configuration, TanStack Router does not detect tsr.config.json in the project root, but will detect it if the file is moved to the app directory. Once moved to the app directory, the TanStack Router Vite plugin will successfully generate the routes on vite dev boot, but will not detect and re-generate based on adding and removing files in the app/routes directory.

Your Example Website or App

https://github.com/a-maas/ts-router-ex

Steps to Reproduce the Bug or Issue

  1. Clone this repository
  2. Run npm install
  3. Run npm run dev
  4. Observe that the routes are generated on boot.
  5. Add a test.tsx file to the app/routes directory.
  6. Observe that the routes are not re-generated.

Expected behavior

As a user, I expect the TanStack Router Vite plugin to re-generate routes when I add and remove files from the configured routes directory, even when Vite is configured with a non-standard root.

Screenshots or Videos

No response

Platform

  • OS: macOS 14.4
  • Browser: N/A
  • Editor: VSCode

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