ant-design-pro: 🐛 [BUG] Ant Design Pro with Umi3 No Longer Compiles
🐛 bug 描述
Ant Design Pro with Umi3 no longer compiles. Upon yarn install, and yarn start, it fails with @babel/helper-compilation-targets: ‘opera_mobile’ is not a valid target. This has made our company’s production app that we built off of the antd umi3 template unable to build anymore and has stopped us from making any further releases to our customers.
ERROR in ./src/components/index.md
Module build failed (from ./node_modules/@umijs/preset-dumi/lib/loader/index.js):
Error: [BABEL] /Users/ramesh/my-directory/myapp/src/components/index.tsx: @babel/helper-compilation-targets: 'opera_mobile' is not a valid target
- Did you mean 'opera'? (While processing: "/Users/my-directory/myapp/node_modules/@umijs/babel-preset-umi/app.js$0$0$39")
📷 复现步骤 | Recurrence steps
Env: Tried both Node v16.16.0 and v18.5.0 but did not work yarn v1.22.17
npm i @ant-design/pro-cli -g
pro create myapp
Select use umi@3
yarn install
yarn start
🏞 期望结果 | Expected results
Should have compiled and host at localhost:8000
💻 复现代码 | Recurrence code
© 版本信息
- Ant Design Pro 版本: [e.g. 4.0.0]
- umi 版本
- 浏览器环境
- 开发环境 [e.g. mac OS]
🚑 其他信息
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 7
- Comments: 22 (4 by maintainers)
把 ./src/components/index.md 删了试试
解决方案:删除index.md,把依赖删掉和umi文件夹删除,yarn一下,然后运行
感谢反馈,我重新创建脚手架试了下的确有问题,原因是 package.json 中的 browserslist 配置影响了 targets 值引发报错;dumi 发了
@umijs/preset-dumi@1.1.53
禁用 browserslist 配置读取,我这里验证可以编译了,有空可以再试试看Please pin browserslist to
<4.21.9
.As umit 3 is not maintained, the
@umi/deps
is inevitably aging because it bundles quite a lot of building tools: Even if you upgrade Babel to the latest version, under the hood@umi/deps
is still using Babel 7.13. Doing so is less memory efficient and prone to compatibility issues.I suggest pin all your dev dependencies before you migrate to umi 4.