Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#52854 closed enhancement (fixed)

Update polyfill libraries for 5.8

Reported by: desrosj's profile desrosj Owned by: desrosj's profile 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 (14)

#1 @desrosj
4 years ago

  • Description modified (diff)

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


4 years ago

#4 follow-up: @gziolo
4 years ago

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

https://github.com/WordPress/wordpress-develop/blob/32e8cd1c2d0a006758d0b88dc3cfa59096cc1776/tools/webpack/packages.js#L76-L83

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:
https://babeljs.io/docs/en/babel-polyfill

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):

https://github.com/WordPress/gutenberg/blob/169a0cab4d6ee263014313276d60df970dd8c608/lib/client-assets.php#L213-L223

Version 0, edited 4 years ago by gziolo (next)

#5 in reply to: ↑ 4 @desrosj
4 years 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.


4 years ago
#6

  • Keywords has-patch added; needs-patch removed

#7 @desrosj
4 years 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
4 years ago

In 50617:

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

Follow up to [50615].

Props gziolo.
Fixes #52854.

#10 @desrosj
4 years ago

In 50619:

External Libraries: Update polyfill versions in the script loader.

Follow up to [50615, 50617].

See #52854.

#11 @gziolo
4 years 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
4 years ago

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

#13 @desrosj
4 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened
  • Summary changed from Update polyfill libraries to Update polyfill libraries for 5.8

#14 @desrosj
4 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 51017:

External Libraries: Update two polyfill libraries to their latest versions.

This updates the following polyfill libraries bundled with WordPress to their latest versions:

  • formdata-polyfill from 3.0.20 to 4.0.0.
  • polyfill-library from 3.104.0 to 3.105.0.

Fixes #52854.

Note: See TracTickets for help on using tickets.