Unable to polyfill `Object.fromEntries` using babel/preset-env
Asked Answered
I

0

8

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?

Illuminance answered 9/7, 2022 at 8:33 Comment(2)
Did you ever find a solution to this? I am facing a similar issueArgentic
Plus one. Even with the useBuiltIns: "usage" this function remains as it is.Iconolatry

© 2022 - 2024 — McMap. All rights reserved.