Make WordPress Core

Opened 8 weeks ago

Closed 6 weeks ago

Last modified 6 weeks ago

#52854 closed enhancement (fixed)

Update polyfill libraries

Reported by: desrosj Owned by: desrosj
Milestone: 5.8 Priority: normal
Severity: normal Version:
Component: External Libraries Keywords: has-patch
Focuses: javascript Cc:

Description (last modified by desrosj)

There are a handful of polyfill libraries listed as devDependencies that have available updates:

  • objectFitPolyfill: Core has 2.3.4, latest is 2.3.5 (introduced in [50048]).
  • formdata-polyfill: Core has 3.0.13, latest is 3.0.20 (last updated in [44728]).
  • polyfill-library: Core has 3.42.0, latest is 3.103.0 (last updated in [47238]).

These are block editor related, but they do not appear to be listed as dependencies in the Gutenberg repo anymore.

We should:

  • Confirm they are still required.
  • Remove them if not.
  • Update to the latest versions.

The scenarios where they are used need to be identified and tested.

Related: #52851.

Change History (12)

#1 @desrosj
8 weeks ago

  • Description modified (diff)

This ticket was mentioned in Slack in #core-editor by desrosj. View the logs.

8 weeks ago

#4 follow-up: @gziolo
6 weeks ago

They aren't listed in the Gutenberg plugin anymore because they are handled in WordPress core here:


My quick guess is - as long as we support IE 11 we need all those polyfills so it would be a good idea to upgrade them.

I also see that @babel/polyfill is deprecated and should be replaced with core-js/stable:

It also looks like we need to sync the version of objectFitPolyfill in the Gutenberg plugin as it is outdated (it adds it for older versions of WP):


Version 0, edited 6 weeks ago by gziolo (next)

#5 in reply to: ↑ 4 @desrosj
6 weeks ago

Replying to gziolo:

My quick guess is - as long as we support IE 11 we need all those polyfills so it would be a good idea to upgrade them.

I think, unfortunately, because they are bundled in Core, we'll need to keep them in Core for some time. If a plugin or theme is adding the script as a dependency, removing it could break their code.

I checked out the changes in these polyfills, and they all seem relatively safe to include. I'm going to update them, and then I'll open a PR for updating objectFitPolyfill in Gutenberg.

I think we should split off a separate ticket for the @babel/polyfill library update.

This ticket was mentioned in PR #1140 on WordPress/wordpress-develop by desrosj.

6 weeks ago

  • Keywords has-patch added; needs-patch removed

#7 @desrosj
6 weeks ago

  • Owner set to desrosj
  • Resolution set to fixed
  • Status changed from new to closed

In 50615:

External Libraries: Update several polyfill libraries.

This updates the following polyfill libraries:

  • formdata-polyfill from 3.0.13 to 3.0.20.
  • objectFitPolyfill from 2.3.4 to 2.3.5.
  • polyfill-library from 3.42.0 to 3.104.0.

Props gziolo, desrosj.
Fixes #52854.

#9 @desrosj
6 weeks ago

In 50617:

External Libraries: Update the path to polyfill-library files in Webpack.

Follow up to [50615].

Props gziolo.
Fixes #52854.

#10 @desrosj
6 weeks ago

In 50619:

External Libraries: Update polyfill versions in the script loader.

Follow up to [50615, 50617].

See #52854.

#11 @gziolo
6 weeks ago

Updating those polyfill libraries isn't the most intuitive process :(

I think we should split off a separate ticket for the @babel/polyfill library update.

I agree. It's going to be its own set of issues because we will have to create a webpack entry point that imports core-js and regenerator-runtime.

import 'core-js/stable';
import 'regenerator-runtime/runtime';

They aren't defined as dependencies in package.json at the moment.

#12 @gziolo
6 weeks ago

I created #52946 for @babel/polyfill changes, but I won't have time to work on it this week.

Note: See TracTickets for help on using tickets.