Skip to content

fix(preset-umi): fix clickToComponent path injection on Windows#13221

Open
rurounibatousai wants to merge 1 commit intoumijs:masterfrom
rurounibatousai:fix/click-to-component-windows
Open

fix(preset-umi): fix clickToComponent path injection on Windows#13221
rurounibatousai wants to merge 1 commit intoumijs:masterfrom
rurounibatousai:fix/click-to-component-windows

Conversation

@rurounibatousai
Copy link
Copy Markdown

Description

This PR fixes an issue where clickToComponent fails to open files correctly on Windows due to path escaping issues in the generated runtime code.

Issues Fixed

  1. Invalid String Injection: Previously, api.paths.cwd was injected directly into a template string via '${api.paths.cwd}'. On Windows, paths like C:\Users caused syntax errors or invalid escapes in the generated runtime.tsx.
  2. Path Normalization: Handled inconsistent usage of backslashes (\) and forward slashes (/).
  3. JSX Syntax: Fixed the editor prop being passed as a literal string "${...}" instead of a variable.

Solution

  • Used JSON.stringify(winPath(api.paths.cwd)) to inject the CWD safely.
  • Added a runtime normalize function and isAbsoluteLike check to support Windows paths and VS Code URI schemes.

@vercel
Copy link
Copy Markdown

vercel Bot commented Dec 23, 2025

@rurounibatousai is attempting to deploy a commit to the chencheng's projects Team on Vercel.

A member of the Team first needs to authorize it.

@rurounibatousai rurounibatousai marked this pull request as draft December 27, 2025 08:11
@rurounibatousai rurounibatousai marked this pull request as ready for review December 27, 2025 08:11
@flgame
Copy link
Copy Markdown

flgame commented Mar 20, 2026

@xiaohuoni 大佬能合并发布下么

@rurounibatousai
Copy link
Copy Markdown
Author

rurounibatousai commented Apr 15, 2026

@xiaohuoni大佬能合并发布下么

哥们才看到你的回复,邮件被塞满了,你的回复消息被压倒最下面去了,不好意思,我应该是没有权限合并的,哈哈哈 可能需要他们官方的来搞吧,我也不知道,实际上你把你的文件夹名字改一下应该就好了,不要用那种 /t ,带有转义的名称开头,你看看能不能帮助到你,也不要使用数字开头。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants