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
- 新建一个含特殊字符(')的目录,例如 Use'r
- 进入目录里
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
可能的解决方案建议
- 使用双引号包裹路径字符串(import "...")
- 在生成路径时对单引号进行转义
- 检测路径中的特殊字符并自动处理
What happens?
当项目路径包含单引号 ' 时(例如 C:/Users/Jeri'o/...),Umi 自动生成的 polyfill.ts 文件中的导入路径字符串会因未转义单引号导致语法错误,具体报错如下:
How To Reproduce
npx create-umi@latest项目github仓库:https://github.com/leelynnjaytop/umi
在线复现链接:https://1024code.com/~lilinjie/nry6osa
Context
可能的解决方案建议