Skip to content

Commit

Permalink
Build/Test Tools: Replace the deprecated @babel/polyfill.
Browse files Browse the repository at this point in the history
This replaces the dependency of the deprecated `@babel/polyfill` package with the `core-js` package through `@wordpress/babel-preset-default`.

Previously, the file consisted of a generalized group of polyfills, and not all of them were required. This change allows the contents of this file to be built according to the exact needs as dictated by the `@wordpress/babel-preset-default` package, which takes into account the current browser support.

Props gziolo, youknowriad. 
Fixes #52941.

git-svn-id: https://develop.svn.wordpress.org/trunk@51146 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
desrosj committed Jun 14, 2021
1 parent 18ebf26 commit 825a9c7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 13 deletions.
12 changes: 2 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"last 2 Opera versions"
],
"devDependencies": {
"@wordpress/babel-preset-default": "6.2.0",
"@wordpress/custom-templated-path-webpack-plugin": "2.0.5",
"@wordpress/dependency-extraction-webpack-plugin": "3.1.4",
"@wordpress/e2e-test-utils": "5.3.0",
Expand Down Expand Up @@ -76,7 +77,6 @@
"webpack-livereload-plugin": "2.3.0"
},
"dependencies": {
"@babel/polyfill": "7.10.1",
"@wordpress/a11y": "3.1.1",
"@wordpress/annotations": "2.1.1",
"@wordpress/api-fetch": "5.1.1",
Expand Down
4 changes: 2 additions & 2 deletions tools/webpack/packages.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ module.exports = function( env = { environment: 'production', watch: false, buil

const vendors = {
'lodash.js': 'lodash/lodash.js',
'wp-polyfill.js': '@babel/polyfill/dist/polyfill.js',
'wp-polyfill.js': '@wordpress/babel-preset-default/build/polyfill.js',
'wp-polyfill-fetch.js': 'whatwg-fetch/dist/fetch.umd.js',
'wp-polyfill-element-closest.js': 'element-closest/element-closest.js',
'wp-polyfill-node-contains.js': 'polyfill-library/polyfills/__dist/Node.prototype.contains/raw.js',
Expand All @@ -88,7 +88,7 @@ module.exports = function( env = { environment: 'production', watch: false, buil

const minifiedVendors = {
'lodash.min.js': 'lodash/lodash.min.js',
'wp-polyfill.min.js': '@babel/polyfill/dist/polyfill.min.js',
'wp-polyfill.min.js': '@wordpress/babel-preset-default/build/polyfill.min.js',
'wp-polyfill-formdata.min.js': 'formdata-polyfill/formdata.min.js',
'wp-polyfill-url.min.js': 'core-js-url-browser/url.min.js',
'wp-polyfill-object-fit.min.js': 'objectFitPolyfill/dist/objectFitPolyfill.min.js',
Expand Down

0 comments on commit 825a9c7

Please sign in to comment.