Click-to-code does not work when command run from different directory
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 499
- Forks
- 100
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 4
Description
TanStack Devtools version
0.3.11
Framework/Library version
React 19.2.0
Describe the bug and the steps to reproduce it
If the Vite command is run from a different directory than what the Vite root is (we do this because we have a big monorepo), the click-to-code feature does not work. When making a custom editor config, I can see that the filePath includes duplication of some parts of the path (/Users/literalpie/my-repo/config/Users/literalpie/my-repo/src/App.tsx)
I believe the problem is that cwd is used to clean up the path, but cwd might not match what's in the vite id path.
Your Minimal, Reproducible Example - (Sandbox Highly Recommended)
https://stackblitz.com/edit/vitejs-vite-bvszfdfc?file=config%2Fvite.config.ts,README.md&terminal=dev
Screenshots or Videos (Optional)
No response
Do you intend to try to help solve this bug with your own PR?
No, because I do not have time to dig into it
Terms & Code of Conduct
- I agree to follow this project's Code of Conduct
- I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in packages/devtools-vite/src/inject-source.ts around line 259, where cwd is used to clean up the Vite id path. Reproduce the issue with the linked StackBlitz example using a Vite command from a different directory than the Vite root, then verify click-to-code produces a non-duplicated filePath.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript, vite
- Domain
- build-system, devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100