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

【Task】Babel 7.22 Breaking change 应对 #11202

Closed
fz6m opened this issue May 26, 2023 · 0 comments · Fixed by #11326
Closed

【Task】Babel 7.22 Breaking change 应对 #11202

fz6m opened this issue May 26, 2023 · 0 comments · Fixed by #11326

Comments

@fz6m
Copy link
Member

fz6m commented May 26, 2023

背景

由于大批新 es 语法进入 stage 4 ,故 babel 7.22 改名了这些 proposal 的包,并放弃原 npm 包的更新。

问题

对 Umi 的问题

对于 umi 来说,由于依赖预打包了,所以全新的 umi 项目不会含有任何 babel 依赖,无明显风险。

对社区的问题

这将导致更新版本后,所有显示的幽灵依赖导入失效:

  // 💥 若没有显示安装,将会找不到
  require('@babel/plugin-proposal-class-properties')

原因是新版本 babel/preset-env 不再含有 proposal 名字的包了(被改名了)。

升级方式

目前 umi 内预打包这些依赖,所以建议升级方式为:

  1. 更名 + 升级

  2. 保留原出口位置,新增一套新出口。

其他

由于 CRA 已经 遭遇 此问题,但 babel 只采取了临时解,不是根本解,此 Breaking 可能在社区进一步发酵引起新的变化,故待观望一小段时间后再做实际升级

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 a pull request may close this issue.

1 participant