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

459 views Asked by At

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?

0

There are 0 answers