Skip to content

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

@aduth

Description

@aduth

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrameworkIssues related to broader framework topics, especially as it relates to javascript[Type] EnhancementA suggestion for improvement.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions