Click-to-code does not work when command run from different directory
还没有人认领这个 Issue。
- 主要语言
- TypeScript
- 星标
- 499
- 派生
- 100
- 平均合并
- 1 天 17 小时
- 30 天内合并 PR
- 4
描述
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.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 packages/devtools-vite/src/inject-source.ts 第 259 行附近开始,这里使用 cwd 清理 Vite id 路径。使用来自不同于 Vite 根目录的目录中的 Vite 命令,通过链接的 StackBlitz 示例重现该问题,然后验证 click-to-code 生成的 filePath 没有重复。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- react, typescript, vite
- 领域
- build-system, devtools
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 48/100