-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Describe the bug
I noticed that vite-plugin and the router generator use a different root when handling the routesDirectory from the router config.
Consider my vite root directory in /src/renderer. When I specify ./src/renderer/src/routes as my routesDirectory the vite-plugin is joining the path together with vite.root, when handling a hot update. This results in /src/renderer/src/renderer/src/routes.
On the other hand the router-generator is joining the path with the projects root directory. This results in /src/renderer/src/routes, which is correct. The problem is now, that either the vite plugin is watching the wrong directory or the generator can't find the right files.
Your Example Website or App
https://stackblitz.com/edit/github-k8oxxb
Steps to Reproduce the Bug or Issue
- Create a vite project with the vite config file at the project root.
- Move the index.html and the src directory to ./ui
- Specify
rootas./uiin the vite config - Setup TanstackRouter with the vite plugin and
routesDirectory: './ui'
Expected behavior
I expect that the routes gets processed properly and the vite plugin is detecting changes. The outcome is, that the routes gets generated at vite startup, but not when I do changes to the files.
Screenshots or Videos
No response
Platform
Not platform specific
Additional context
See packages/router-vite-plugin/src/index.ts at line 23
and packages/router-generator/src/generator.ts at line 136