无法使用babel/preset-env polyfly`object.fromentries`

发布于 2025-02-14 01:55:39 字数 640 浏览 2 评论 0原文

我是否误解了有关babel/preset-env的某些内容? 我正在使用vitejs/plugin-leggacy使用babel配置来进行VITE,但用于Astrojs项目。

plugins: [
  legacy({
    targets: ['defaults', 'not IE 11', 'ios_saf > 10']
  })
]

从我的理解来看,简单地指定浏览列表查询应该足以使Babel产生适当的多填充:

我们利用这些数据源来维护哪种版本的我们支持的目标环境获得了对JavaScript语法或浏览器功能的支持,以及这些语法和功能的映射到Babel Transform Transform插件和Core-js Polyfills。<<<<<<<<<<< /p>

如果object.fromentries不支持ios_saf&lt; 12,但是是ECMA 2019的一部分,为什么我的测试浏览器(IS_SAF 11)为此功能引起了错误?

Am I misunderstanding something about or misconfiguring babel/preset-env?
I'm using babel configs for vite using vitejs/plugin-legacy, but for AstroJS project.

plugins: [
  legacy({
    targets: ['defaults', 'not IE 11', 'ios_saf > 10']
  })
]

From my understanding, simply specifying the browserslist query should be enough for babel to generate the appropriate polyfills:

We leverage these data sources to maintain mappings of which version of our supported target environments gained support of a JavaScript syntax or browser feature, as well as a mapping of those syntaxes and features to Babel transform plugins and core-js polyfills.

If Object.fromEntries is not supported in ios_saf < 12 but is part of the ECMA 2019, why does my test browser (which is ios_saf 11) raise an error for this function?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文