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 路径中的单引号导致语法错误 #12934

Open
leelynnjaytop opened this issue Feb 21, 2025 · 1 comment
Labels

Comments

@leelynnjaytop
Copy link

leelynnjaytop commented Feb 21, 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. 新建一个含特殊字符(')的目录,例如 Use'r
  2. 进入目录里 npx create-umi@latest

项目github仓库:https://github.com/leelynnjaytop/umi
在线复现链接:https://1024code.com/~lilinjie/nry6osa

Context

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

可能的解决方案建议

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

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

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Feb 21, 2025
@github-actions github-actions bot reopened this Feb 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants