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

Scripts: Upgrade babel-polyfill (or use core-js or alternative directly) #22417

Closed
aduth opened this issue May 18, 2020 · 2 comments
Closed

Scripts: Upgrade babel-polyfill (or use core-js or alternative directly) #22417

aduth opened this issue May 18, 2020 · 2 comments
Labels
Framework Issues related to broader framework topics, especially as it relates to javascript [Type] Enhancement A suggestion for improvement.

Comments

@aduth
Copy link
Member

aduth commented May 18, 2020

Related: #21492 (comment)

As noted at #21492 (comment) , the version of wp-polyfill shipped in WordPress today is associated with @babel/polyfill@7.4.4. The latest version of @babel/polyfill is 7.8.7. It's assumed this would use a newer version of core-js and thus, polyfills for more new language features in use today in Gutenberg.

A few cases have occurred where a desire or attempt is made to use new language features which are newer than are shipped in polyfills:

  1. Array#flat (Cover: Add Padding Styles #21492 (comment))
  2. Object.fromEntries (Add Block Pattern Categories support #22164 (comment))

This may become an increasingly common scenario, as the availability and usage of newer language features starts to increase.

Implementation Notes:

Note that @babel/polyfill is officially deprecated. This doesn't necessarily mean we couldn't still choose to upgrade from 7.4.4 to 7.8.7 (the latest and probably last version).

Alternatively, at its core, @babel/polyfill is essentially a small wrapper around core-js (source). We could choose to use core-js directly.

Since this is a script handle shipped already with Core, it would inevitably need an upstream patch. It could be done sooner in Gutenberg following the pattern such as in #14400 / Trac#48121.

@aduth aduth added [Type] Enhancement A suggestion for improvement. Framework Issues related to broader framework topics, especially as it relates to javascript labels May 18, 2020
@gziolo
Copy link
Member

gziolo commented Jun 29, 2020

Let's try to mitigate the issue in WordPress core with upgrading @babel/polyfill to the latest version with WordPress/wordpress-develop#367.

@gziolo
Copy link
Member

gziolo commented Mar 30, 2021

It's being discussed in https://core.trac.wordpress.org/ticket/52854, so let's close this issue in favor on the WordPress trac ticket.

@gziolo gziolo closed this as completed Mar 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Framework Issues related to broader framework topics, especially as it relates to javascript [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

2 participants