ember-cli-babel icon indicating copy to clipboard operation
ember-cli-babel copied to clipboard

Array.prototype.flat polyfill is missing

Open yratanov opened this issue 6 years ago • 10 comments

Hello, I'm using "ember-cli-babel": "^7.7.3"

array.flat in Edge browser throws an error, while array.flatMap is working.

yratanov avatar May 07 '19 01:05 yratanov

may be related with:

https://github.com/babel/babel/issues/9749

yratanov avatar May 07 '19 01:05 yratanov

I confirm. Looks like there is no polyfill for that

Exelord avatar Jul 24 '19 19:07 Exelord

Babel polyfill has been deprecated. (https://github.com/babel/babel/tree/master/packages/babel-polyfill)

We should upgrade this package to use core-js explicitly.

Exelord avatar Jul 25 '19 15:07 Exelord

@rwjblue any plans moving to core-js 3? :)

Exelord avatar Jul 31 '19 18:07 Exelord

I haven't really looked into it much, but off the cuff I would think that we would follow suit with Babel and remove the polyfilling.

Folks would then use something like ember-auto-import to get these polyfills like the @babel/polyfill site suggests.

rwjblue avatar Aug 01 '19 14:08 rwjblue

@rwjblue - we just hit the same issue (flat missing). I don't understand your comment - is there something we can do right now as users or we have to wait for ember-cli-babel to be updated?

boris-petrov avatar Aug 07 '19 13:08 boris-petrov

Also curious if there is something that could be done now

dbashford avatar Aug 22 '19 23:08 dbashford

One option is to use https://github.com/pzuraq/ember-cli-babel-polyfills, just updated it to use the latest core-js and confirmed it has Array.flat, plus it ensures that the polyfills are only included in legacy browsers by using nomodule, so modern users don't pay the cost 😄

pzuraq avatar Aug 23 '19 04:08 pzuraq

Awesome. Yep that's the solution :)

Exelord avatar Aug 23 '19 09:08 Exelord

That gets flat in (via core-js/stable), if I was interested in all the esnext stuff as well, should I just be importing core-js myself? Or might that be something ember-cli-babel-polyfills or eventually ember-cli-babel may support?

dbashford avatar Aug 28 '19 21:08 dbashford

Going to close this as polyfill support was removed in v8.

bertdeblock avatar Jan 28 '23 09:01 bertdeblock