Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] .umi/core/helmet.ts 自动生成时未正确处理 Windows 路径中的单引号导致语法错误 #12912

Closed
leelynnjaytop opened this issue Feb 8, 2025 · 1 comment

Comments

@leelynnjaytop
Copy link

leelynnjaytop commented Feb 8, 2025

What happens?

当项目路径包含单引号 ' 时(例如 C:/Users/Jeri'o/...),Umi 自动生成的 polyfill.ts 文件中的导入路径字符串会因未转义单引号导致语法错误,具体报错如下:

 npm install

> ant-design-pro@6.0.0-beta.1 postinstall
> max setup

info  - [你知道吗?] 编写 src/loading.(jsx|tsx) 可以自定义页面的加载动画。
info  - generate files
fatal - SyntaxError: ....../polyfill.ts: Missing semicolon. (3:22)

  1 |
  2 | import 'core-js';
> 3 | import 'C:/Users/Jeri'o/Desktop/project/....../frontend/node_modules/@umijs/preset-umi/node_modules/regenerator-runtime/runtime.js';
    |                       ^
  4 | export {};
  5 |
    at constructor (C:\Users\......

How To Reproduce

  1. 在 Windows 系统下创建包含单引号的路径(如 C:/Users/Jeri'o/project
  2. 使用 pnpm create umi 初始化项目
  3. 运行 pnpm installpnpm dev
  4. 观察控制台报错

Context

  • 操作系统:Windows 11
  • Umi 版本:4.1.1
  • Node.js 版本:18.x
  • 包管理器:pnpm 8.x

可能的解决方案建议

  1. 使用双引号包裹路径字符串(import "...")
  2. 在生成路径时对单引号进行转义(Jeri'o)
  3. 检测路径中的特殊字符并自动处理
Copy link

github-actions bot commented Feb 8, 2025

由于缺乏足够的信息,我们暂时关闭了该 Issue。请修改(不要回复) Issue 提供最小重现以重新开启。谢谢。

@leelynnjaytop leelynnjaytop changed the title [Bug] say something [Bug] polyfill.ts 自动生成时未正确处理 Windows 路径中的单引号导致语法错误 Feb 8, 2025
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Feb 8, 2025
@leelynnjaytop leelynnjaytop changed the title [Bug] polyfill.ts 自动生成时未正确处理 Windows 路径中的单引号导致语法错误 [Bug] .umi/core/helmet.ts 自动生成时未正确处理 Windows 路径中的单引号导致语法错误 Feb 21, 2025
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

No branches or pull requests

1 participant