WordPress.org

Make WordPress Core

Opened 6 months ago

Last modified 4 days ago

#52331 new defect (bug)

Consider using more precise browser versions for `browserslist`

Reported by: desrosj Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.9
Component: Build/Test Tools Keywords: 2nd-opinion has-patch has-unit-tests
Focuses: Cc:

Description (last modified by desrosj)

The browserslist array within the package.json file is used to inform the autoprefixer package which CSS vendor prefixes should be present in Core CSS files. This process happens when npm run grunt precommit:css is run.

Within trunk

Currently, browser support is defined relatively as such:

  • Browsers with > 1% global usage.
  • IE >= 11.
  • The last 1 version of Android and ChromeAndroid.
  • The last 2 versions of Chrome, Firefox, Safari, iOS (which generally is the same version as Safari since the versions coincide), Edge, and Opera.

Since Chrome version 25, the Android and desktop versions of Chrome are aligned with stable releases available at the sime time between the two. Because of this, the ChromeAndroid item can probably be removed, or should be updated to last 2 ChromeAndroid to be accurate.

Older Branches

These relative values work within trunk, but they could potentially cause issues in older branches over time. Values are relative to the day the command is run and not to when each major version was released. Running npm run grunt precommit while working within older branches will eventually result unwanted CSS changes as more new browser versions are released.

I'm proposing that when a major version is branched, the browserslist array gets updated with precise versioning to ensure that the browsers supported on release day will continue to be supported into the future, and prevents unnecessary/undesired CSS changes within minor releases. The > 1% should also be removed after branching because usage changes over time, and this could also result in some vendor prefixes being unintentionally removed.

For the 5.6 branch, the below values would be used.

Browser Version
ie >= 11
Android >= 11
ChromeAndroid >= 87
Chrome >= 87
Firefox >= 81
Safari >= 13
iOS >= 13
Edge >= 41
Opera >= 66

WordPress 4.9 was the first major version to use relative versioning (see [41062]).

I've gone and done some research, and below is the list of browser versions on each major version's release day that would have met the relative requirements.

WP Version IE Android ChromeAndroid Chrome Firefox Safari iOS Edge Opera
5.6 (12/8/2020) 11 11 87 87 81 13 13 41 66
5.5 (8/11/2020) 11 10 83 83 79 12 12 41 66
5.4 (3/31/2020) 11 10 79 79 73 12 12 41 65
5.3 (11/12/2019) 11 10 77 77 69 12 12 40 63
5.2 (5/7/2019) 11 9 73 73 65 11 11 40 58
5.1 (2/21/2019) 11 9 71 71 63 11 11 40 57
5.0 (12/6/2018) 11 9 70 70 62 11 11 40 56
4.9 (11/16/2017) 11 8 61 61 56 10 10 40 48

Change History (50)

#1 @desrosj
6 months ago

Another thing to consider is that many browsers are now following a more rapid release model. last 2 may also no longer be sufficient to capture the desired level of browser support between major releases.

#2 @desrosj
6 months ago

  • Description modified (diff)

#3 follow-up: @desrosj
6 months ago

Was playing around with some of this today. It looks like the browserlist package does not recognize the "Spartan" releases of Edge listed here. The current version is within the "Anaheim" series, but this series was not released until 1/15/2020 (shortly after WordPress 5.3).

Running npx browserslist "Edge >= 1" produces the following output (which does not include any Spartan releases):

edge 87
edge 86
edge 85
edge 84
edge 83
edge 81
edge 80
edge 79
edge 18
edge 17
edge 16
edge 15
edge 14
edge 13
edge 12

With this in mind, I'm not sure what the versions for Edge should be for branches <= 5.3, but these adjustments to the table above are needed:

  • 5.6: >= 85
  • 5.5: >= 83
  • 5.4: >= 79

This ticket was mentioned in Slack in #core by metalandcoffee. View the logs.


6 months ago

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


6 months ago

  • Keywords has-patch has-unit-tests added

This updates the 5.5 branch to run on the latest LTS version of NodeJS (currently 14.x).

### Update devDependencies
All development dependencies have been updated to versions that support 14.x. The following commits are included as backports:

### browserslist updates
This PR also includes changes suggested in Core-52331 to ensure consistent vendor prefixes within the branch as time progresses.

Trac ticket:

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


6 months ago

This updates the 5.4 branch to run on the latest LTS version of NodeJS (currently 14.x).

### Update devDependencies
All development dependencies have been updated to versions that support 14.x. The following commits are included as backports:

### browserslist updates
This PR also includes changes suggested in Core-52331 to ensure consistent vendor prefixes within the branch as time progresses.

### Generated files
All generated JS/CSS files have been updated.

### Simulating build server output
A companion PR has been opened to simulate the output of the build server after the changes in this PR: https://github.com/WordPress/WordPress/pull/509.

Trac ticket:

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


6 months ago

This updates the 5.3 branch to run on the latest LTS version of NodeJS (currently 14.x).

### Update devDependencies
All development dependencies have been updated to versions that support 14.x. The following commits are included as backports:

### browserslist updates
This PR also includes changes suggested in Core-52331 to ensure consistent vendor prefixes within the branch as time progresses.

### Generated files
All generated JS/CSS files have been updated.

### Simulating build server output
A companion PR has been opened to simulate the output of the build server after the changes in this PR: https://github.com/WordPress/WordPress/pull/510.

Trac ticket:

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


6 months ago

This updates the 5.2 branch to run on the latest LTS version of NodeJS (currently 14.x).

### Update devDependencies
All development dependencies have been updated to versions that support 14.x. The following commits are included as backports:

### browserslist updates
This PR also includes changes suggested in Core-52331 to ensure consistent vendor prefixes within the branch as time progresses.

### Generated files
All generated JS/CSS files have been updated.

### Simulating build server output
A companion PR has been opened to simulate the output of the build server after the changes in this PR: https://github.com/WordPress/WordPress/pull/511.

Trac ticket:

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


6 months ago

This updates the 5.2 branch to run on the latest LTS version of NodeJS (currently 14.x).

### Update devDependencies
All development dependencies have been updated to versions that support 14.x. The following commits are included as backports:

### browserslist updates
This PR also includes changes suggested in Core-52331 to ensure consistent vendor prefixes within the branch as time progresses.

### Generated files
All generated JS/CSS files have been updated.

### Simulating build server output
A companion PR has been opened to simulate the output of the build server after the changes in this PR: https://github.com/WordPress/WordPress/pull/512.

Trac ticket:

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


6 months ago

This updates the 5.0 branch to run on the latest LTS version of NodeJS (currently 14.x).

### Update devDependencies
All development dependencies have been updated to versions that support 14.x. The following commits are included as backports:

### browserslist updates
This PR also includes changes suggested in Core-52331 to ensure consistent vendor prefixes within the branch as time progresses.

### Generated files
All generated JS/CSS files have been updated.

### Simulating build server output
A companion PR has been opened to simulate the output of the build server after the changes in this PR: https://github.com/WordPress/WordPress/pull/513.

Trac ticket:

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


6 months ago

This updates the 4.9 branch to run on the latest LTS version of NodeJS (currently 14.x).

### Update devDependencies
All development dependencies have been updated to versions that support 14.x. The following commits are included as backports:

### browserslist updates
This PR also includes changes suggested in Core-52331 to ensure consistent vendor prefixes within the branch as time progresses.

### Generated files
All generated JS/CSS files have been updated.

### Simulating build server output
A companion PR has been opened to simulate the output of the build server after the changes in this PR: https://github.com/WordPress/WordPress/pull/513.

Trac ticket:

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


6 months ago

This updates the 4.8 branch to run on the latest LTS version of NodeJS (currently 14.x).

### Update devDependencies
All development dependencies have been updated to versions that support 14.x. The following commits are included as backports:

### browserslist updates
This PR also includes changes suggested in Core-52331 to ensure consistent vendor prefixes within the branch as time progresses.

### Generated files
All generated JS/CSS files have been updated.

### Simulating build server output
A companion PR has been opened to simulate the output of the build server after the changes in this PR: https://github.com/WordPress/WordPress/pull/513.

Trac ticket:

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


6 months ago

This updates the 4.7 branch to run on the latest LTS version of NodeJS (currently 14.x).

### Tooling
This backports https://core.trac.wordpress.org/changeset/39361 to prevent accidentally including patch related files.

### Update devDependencies
All development dependencies have been updated to versions that support 14.x. The following commits are included as backports:

### browserslist updates
This PR also includes changes suggested in Core-52331 to ensure consistent vendor prefixes within the branch as time progresses.

### Generated files
All generated JS/CSS files have been updated.

### Simulating build server output
A companion PR has been opened to simulate the output of the build server after the changes in this PR: https://github.com/WordPress/WordPress/pull/513.

Trac ticket:

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


6 months ago

This updates the 4.6 branch to run on the latest LTS version of NodeJS (currently 14.x).

### Tooling
This backports https://core.trac.wordpress.org/changeset/39361 to prevent accidentally including patch related files.

### Update devDependencies
All development dependencies have been updated to versions that support 14.x. The following commits are included as backports:

### Removed packages
Dependencies that were not addressed in newer branches and updated in the backports above have also been updated to their latest versions.

### browserslist updates
This PR also includes changes suggested in Core-52331 to ensure consistent vendor prefixes within the branch as time progresses.

### Generated files
All generated JS/CSS files have been updated.

### Simulating build server output
A companion PR has been opened to simulate the output of the build server after the changes in this PR: https://github.com/WordPress/WordPress/pull/517.

Trac ticket:

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


6 months ago

This updates the 4.6 branch to run on the latest LTS version of NodeJS (currently 14.x).

### Tooling
This backports https://core.trac.wordpress.org/changeset/39361 to prevent accidentally including patch related files.

### Update devDependencies
All development dependencies have been updated to versions that support 14.x. The following commits are included as backports:

### Removed packages
Dependencies that were not addressed in newer branches and updated in the backports above have also been updated to their latest versions.

### browserslist updates
This PR also includes changes suggested in Core-52331 to ensure consistent vendor prefixes within the branch as time progresses.

### Generated files
All generated JS/CSS files have been updated.

### Simulating build server output
A companion PR has been opened to simulate the output of the build server after the changes in this PR: https://github.com/WordPress/WordPress/pull/517.

### Local Docker Environment
The local Docker environment is also backported in this branch, though it should be committed separately from the other NodeJS updates.
Merges [45745,45762,45783-45784,45800,45819,45885,46320,46999,47225,47912,48121,49335,49358,49360,49362] to the 4.5 branch.

Trac ticket:

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


6 months ago

This updates the 4.4 branch to run on the latest LTS version of NodeJS (currently 14.x).

### Tooling
This backports https://core.trac.wordpress.org/changeset/39361 to prevent accidentally including patch related files.

### Update devDependencies
All development dependencies have been updated to versions that support 14.x. The following commits are included as backports:

### Removed packages
Dependencies that were not addressed in newer branches and updated in the backports above have also been updated to their latest versions.

### browserslist updates
This PR also includes changes suggested in Core-52331 to ensure consistent vendor prefixes within the branch as time progresses.

### Generated files
All generated JS/CSS files have been updated.

### Simulating build server output
A companion PR has been opened to simulate the output of the build server after the changes in this PR: https://github.com/WordPress/WordPress/pull/518.

### Local Docker Environment
The local Docker environment is also backported in this branch, though it should be committed separately from the other NodeJS updates.
Merges [45745,45762,45783-45784,45800,45819,45885,46320,46999,47225,47912,48121,49335,49358,49360,49362] to the 4.5 branch.

Trac ticket:

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


6 months ago

This updates the 4.3 branch to run on the latest LTS version of NodeJS (currently 14.x).

### Tooling
This backports https://core.trac.wordpress.org/changeset/39361 to prevent accidentally including patch related files.

Additionally, NPM scripts have been backported for consistent build/watch related tasks across all branches. Backports for this include:

### Update devDependencies
All development dependencies have been updated to versions that support 14.x. The following commits are included as backports:

### Removed packages
Dependencies that were not addressed in newer branches and updated in the backports above have also been updated to their latest versions.

### browserslist updates
This PR also includes changes suggested in Core-52331 to ensure consistent vendor prefixes within the branch as time progresses.

### Generated files
All generated JS/CSS files have been updated.

### Simulating build server output
A companion PR has been opened to simulate the output of the build server after the changes in this PR: https://github.com/WordPress/WordPress/pull/518.

### Local Docker Environment
The local Docker environment is also backported in this branch, though it should be committed separately from the other NodeJS updates.
Merges [45745,45762,45783-45784,45800,45819,45885,46320,46999,47225,47912,48121,49335,49358,49360,49362] to the 4.5 branch.

Trac ticket:

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


6 months ago

This updates the 4.2 branch to run on the latest LTS version of NodeJS (currently 14.x).

### Tooling
This backports https://core.trac.wordpress.org/changeset/39361 to prevent accidentally including patch related files.

Additionally, NPM scripts have been backported for consistent build/watch related tasks across all branches. Backports for this include:

### Update devDependencies
All development dependencies have been updated to versions that support 14.x. The following commits are included as backports:

### Removed packages
Dependencies that were not addressed in newer branches and updated in the backports above have also been updated to their latest versions.

### browserslist updates
This PR also includes changes suggested in Core-52331 to ensure consistent vendor prefixes within the branch as time progresses.

### Generated files
All generated JS/CSS files have been updated.

### Simulating build server output
A companion PR has been opened to simulate the output of the build server after the changes in this PR: https://github.com/WordPress/WordPress/pull/521.

### Local Docker Environment
The local Docker environment is also backported in this branch, though it should be committed separately from the other NodeJS updates.
Merges [45745,45762,45783-45784,45800,45819,45885,46320,46999,47225,47912,48121,49335,49358,49360,49362] to the 4.5 branch.

Trac ticket:

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


6 months ago

This updates the 4.1 branch to run on the latest LTS version of NodeJS (currently 14.x).

### Tooling
This backports https://core.trac.wordpress.org/changeset/39361 to prevent accidentally including patch related files.

Additionally, NPM scripts have been backported for consistent build/watch related tasks across all branches. Backports for this include:

### Update devDependencies
All development dependencies have been updated to versions that support 14.x. The following commits are included as backports:

### Removed packages
Dependencies that were not addressed in newer branches and updated in the backports above have also been updated to their latest versions.

### browserslist updates
This PR also includes changes suggested in Core-52331 to ensure consistent vendor prefixes within the branch as time progresses.

### Generated files
All generated JS/CSS files have been updated.

### Simulating build server output
A companion PR has been opened to simulate the output of the build server after the changes in this PR: https://github.com/WordPress/WordPress/pull/522.

### Local Docker Environment
The local Docker environment is also backported in this branch, though it should be committed separately from the other NodeJS updates.
Merges [45745,45762,45783-45784,45800,45819,45885,46320,46999,47225,47912,48121,49335,49358,49360,49362] to the 4.5 branch.

Trac ticket:

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


6 months ago

This updates the 4.0 branch to run on the latest LTS version of NodeJS (currently 14.x).

### Tooling
This backports https://core.trac.wordpress.org/changeset/39361 to prevent accidentally including patch related files.

Additionally, NPM scripts have been backported for consistent build/watch related tasks across all branches. Backports for this include:

### Update devDependencies
All development dependencies have been updated to versions that support 14.x. The following commits are included as backports:

### Removed packages
Dependencies that were not addressed in newer branches and updated in the backports above have also been updated to their latest versions.

### browserslist updates
This PR also includes changes suggested in Core-52331 to ensure consistent vendor prefixes within the branch as time progresses.

### Generated files
All generated JS/CSS files have been updated.

### Simulating build server output
A companion PR has been opened to simulate the output of the build server after the changes in this PR: https://github.com/WordPress/WordPress/pull/523.

### Local Docker Environment
The local Docker environment is also backported in this branch, though it should be committed separately from the other NodeJS updates.
Merges [45745,45762,45783-45784,45800,45819,45885,46320,46999,47225,47912,48121,49335,49358,49360,49362] to the 4.5 branch.

Trac ticket:

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


6 months ago

This updates the 3.9 branch to run on the latest LTS version of NodeJS (currently 14.x).

### Tooling
This backports https://core.trac.wordpress.org/changeset/39361 to prevent accidentally including patch related files.

Additionally, NPM scripts have been backported for consistent build/watch related tasks across all branches. Backports for this include:

### Update devDependencies
All development dependencies have been updated to versions that support 14.x. The following commits are included as backports:

### Removed packages
Dependencies that were not addressed in newer branches and updated in the backports above have also been updated to their latest versions.

### browserslist updates
This PR also includes changes suggested in Core-52331 to ensure consistent vendor prefixes within the branch as time progresses.

### Generated files
All generated JS/CSS files have been updated.

### Simulating build server output
A companion PR has been opened to simulate the output of the build server after the changes in this PR: https://github.com/WordPress/WordPress/pull/524.

### Local Docker Environment
The local Docker environment is also backported in this branch, though it should be committed separately from the other NodeJS updates.
Merges [45745,45762,45783-45784,45800,45819,45885,46320,46999,47225,47912,48121,49335,49358,49360,49362] to the 4.5 branch.

Trac ticket:

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


6 months ago

This updates the 3.9 branch to run on the latest LTS version of NodeJS (currently 14.x).

### Tooling
This backports https://core.trac.wordpress.org/changeset/39361 to prevent accidentally including patch related files.

Additionally, NPM scripts have been backported for consistent build/watch related tasks across all branches. Backports for this include:

### Update devDependencies
All development dependencies have been updated to versions that support 14.x. The following commits are included as backports:

### Removed packages
Dependencies that were not addressed in newer branches and updated in the backports above have also been updated to their latest versions.

### browserslist updates
This PR also includes changes suggested in Core-52331 to ensure consistent vendor prefixes within the branch as time progresses.

### Generated files
All generated JS/CSS files have been updated.

### Simulating build server output
A companion PR has been opened to simulate the output of the build server after the changes in this PR: https://github.com/WordPress/WordPress/pull/525.

### Local Docker Environment
The local Docker environment is also backported in this branch, though it should be committed separately from the other NodeJS updates.
Merges [45745,45762,45783-45784,45800,45819,45885,46320,46999,47225,47912,48121,49335,49358,49360,49362] to the 4.5 branch.

Trac ticket:

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


6 months ago

This updates the 3.7 branch to run on the latest LTS version of NodeJS (currently 14.x).

### Tooling
This backports https://core.trac.wordpress.org/changeset/39361 to prevent accidentally including patch related files.

Additionally, NPM scripts have been backported for consistent build/watch related tasks across all branches. Backports for this include:

### Update devDependencies
All development dependencies have been updated to versions that support 14.x. The following commits are included as backports:

### Removed packages
Dependencies that were not addressed in newer branches and updated in the backports above have also been updated to their latest versions.

### browserslist updates
This PR also includes changes suggested in Core-52331 to ensure consistent vendor prefixes within the branch as time progresses.

### Generated files
All generated JS/CSS files have been updated.

### Simulating build server output
A companion PR has been opened to simulate the output of the build server after the changes in this PR: https://github.com/WordPress/WordPress/pull/526.

### Local Docker Environment
The local Docker environment is also backported in this branch, though it should be committed separately from the other NodeJS updates.
Merges [45745,45762,45783-45784,45800,45819,45885,46320,46999,47225,47912,48121,49335,49358,49360,49362] to the 4.5 branch.

Trac ticket:

#24 @prbot
6 months ago

desrosj commented on PR #885:

For the images, I did run precommit:images and committed the changes in https://github.com/WordPress/wordpress-develop/pull/885/commits/fab68cdac95ef3c9f07f2c93e3516d9a4d514d9a for the 5.5 branch.

It looks like there is one image being "removed", but it's still technically there. The imagemin script just reduced it enough to be considered a 100% change in size. Thinking this over more, though, the image changes are not required. The script should be confirmed as working, but we can exclude the resulting changes from this PR in order to limit the number of files changed in each branch.

#25 @desrosj
6 months ago

Sorry for the noise on this ticket. I was originally going to tackle this at the same time as #52341, but this is really a separate effort that should happen on its own.

I was also noticing some weird changes locally in the branches >= 5.0. Some prefixes are being removed when running precommit:css that should remain. I believe this is happening because caniuse-lite (a nested dependency) is not fully up to date, which causes newer versions of browsers to not be recognized.

#26 @netweb
6 months ago

@desrosj Whilst I understand some of the updates required here, I don't think we should support the older browsers on the older versions of WordPress to be honest.

Most legacy systems, even corporate and enterprise machines that still run Internet Explorer keep these browser versions updated.

Firefox and Chrome automatically update the browser versions, so having for example support of Chrome >=79 for the 5.4 branch and Chrome >=89 for the 5.5 branch I don't think makes much sense

Similar to the Node.js build tools ticket and that the WordPress project does not support old versions of Node.js for the build tooling, similar the WordPress project does not support old browsers.

So much so is that we have had made this decision quite some years ago and the supported browsers are documented in:

https://make.wordpress.org/core/handbook/best-practices/browser-support/

The above configuration is also included in a Gutenberg package:

https://github.com/WordPress/gutenberg/tree/master/packages/browserslist-config

We should look to updating the older branches to also use this config rather than hardcoding these browser versions in each branch of WP

This was previously discussed when we discussed using the same Node.js versions for each branch, that there would be changes to the CSS files due to changes in the supported browser versions, so whilst right now we are ignoring (and removing) these CSS changes from this series of pull requests for now, we should ship these CSS changes just as we should eventually also updated the build tools that compile and minify CSS & JS files and ship those changes, the changes will be minimal but they will also be bug fixes for long known bugs in minified files that are resolved these days with the updated build tool versions

#27 in reply to: ↑ 3 @netweb
6 months ago

Replying to desrosj:

Was playing around with some of this today. It looks like the browserlist package does not recognize the "Spartan" releases of Edge listed here. The current version is within the "Anaheim" series, but this series was not released until 1/15/2020 (shortly after WordPress 5.3).

Running npx browserslist "Edge >= 1" produces the following output (which does not include any Spartan releases):

edge 87
edge 86
edge 85
edge 84
edge 83
edge 81
edge 80
edge 79
edge 18
edge 17
edge 16
edge 15
edge 14
edge 13
edge 12

With this in mind, I'm not sure what the versions for Edge should be for branches <= 5.3, but these adjustments to the table above are needed:

  • 5.6: >= 85
  • 5.5: >= 83
  • 5.4: >= 79

This is due to browserslist uses caniuse data, and it itself doesn't include the spartan series versions either:

https://caniuse.com/usage-table

It's also useful to run npx browserslist@latest --update-db as this updates the caniuse database data in browserslist without having to update browserslist directly, this can also be used in CI code to ensure the caniuse data is always up to date independent of any browserslist release

And per my previous comment, I don't think we should support any of the Edge Spartan releases, IE11 and latest 2 versions of Edge which is v87 & v88 as of yesterday with the v88 release

#48 @kraftner
4 months ago

I happened to find this ticket on a tangential issue: Trying to rebuild the core block styles for a certain WordPress version in isolation. But the problem I faced boils down to exactly what this issue is about.

Me rebuilding core block styles

My approach basically was to look at the package-lock.json of a release to get the versions of the @wordpress/block-library, @wordpress/base-styles, sass and @wordpress/postcss-plugins-preset packages. I also copied the browserslist array from the package.json.

But when I built I still didn't get the same files because of my browserlist/caniuse-lite data of course was more recent. I then tried to get that as well from the package-lock.json file but soon noticed that for some WordPress versions there are multiple different versions of the data spread as sub dependencies of various packages. Since npm apparently offers no way to force those sub-dependencies only manually messing with the package-lock.json remains.

I tried that but still wasn't able to build a 100% match for some WordPress versions (5.6.2 being specifically nasty) before I gave up.

So basically I came here to say two things:

De-duplicate data before release

It would be great if when building/releasing WordPress the data would be updated and brought in sync across all packages like @netweb already proposed and the documentation for browserslist also recommends.

If updating isn't wanted (which seems to be the intention of this ticket) a script similar to the script mentioned above that does the updating could be created that only de-duplicates caniuse-lite without updating. See my next point:

Locking might still not work

I suspect (although that is completely untested) that even if you lock down the browser versions and remove the > 1% rule there still might be changes since the caniuse data might still be changed in the meantime for the specified browser versions. Since caniuse data is a community effort support data might still change for a browser version after a WordPress release even without our browser support definition changing.

So I think the only way to lock down Autoprefixer to a specific behavior is to lock/force all uses of caniuse-lite to a specific version. I think this could maybe be done by running the aforementioned npx browserslist@latest --update-db to only get one instance of caniuse-lite installed at root level, then uninstall that and install the historic version everything should use.

#49 @kraftner
4 months ago

I've written a blog post that covers in detail all the issues that arise with an ever-changing target of caniuse/browserslist. In particular when building core block CSS on your own. I thought it might be interesting in the context of this issue: https://kraftner.com/en/blog/building-your-own-wordpress-core-block-css/

This ticket was mentioned in Slack in #core-js by kraftner. View the logs.


4 days ago

Note: See TracTickets for help on using tickets.