Skip to content

Commit

Permalink
Replace deprecated @babel/polyfill with `@wordpress/babel-preset-de…
Browse files Browse the repository at this point in the history
  • Loading branch information
pierlon committed Jun 14, 2021
1 parent 85ad585 commit e099cd6
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 29 deletions.
4 changes: 2 additions & 2 deletions assets/src/polyfills/wp-polyfill.js
@@ -1,6 +1,6 @@
/**
* External dependencies
* WordPress dependencies
*/
import * as polyfill from '@babel/polyfill';
import * as polyfill from '@wordpress/babel-preset-default/build/polyfill';

export default polyfill;
26 changes: 5 additions & 21 deletions package-lock.json

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

1 change: 0 additions & 1 deletion package.json
Expand Up @@ -23,7 +23,6 @@
"npm": ">= 7"
},
"dependencies": {
"@babel/polyfill": "7.12.1",
"@wordpress/api-fetch": "5.1.1",
"@wordpress/autop": "3.1.1",
"@wordpress/components": "14.1.2",
Expand Down
9 changes: 4 additions & 5 deletions webpack.config.js
Expand Up @@ -159,18 +159,17 @@ const customizer = {
};

const WORDPRESS_NAMESPACE = '@wordpress/';
const BABEL_NAMESPACE = '@babel/';
const gutenbergPackages = [ '@babel/polyfill', '@wordpress/dom-ready', '@wordpress/i18n', '@wordpress/hooks', '@wordpress/html-entities', '@wordpress/url' ].map(
const gutenbergPackages = [ '@wordpress/polyfill', '@wordpress/dom-ready', '@wordpress/i18n', '@wordpress/hooks', '@wordpress/html-entities', '@wordpress/url' ].map(
( packageName ) => {
if ( 0 !== packageName.indexOf( WORDPRESS_NAMESPACE ) && 0 !== packageName.indexOf( BABEL_NAMESPACE ) ) {
if ( 0 !== packageName.indexOf( WORDPRESS_NAMESPACE ) ) {
return null;
}

const camelCaseName = '@wordpress/i18n' === packageName
? 'i18n'
: camelCaseDash( packageName.replace( WORDPRESS_NAMESPACE, '' ).replace( BABEL_NAMESPACE, '' ) );
: camelCaseDash( packageName.replace( WORDPRESS_NAMESPACE, '' ) );

const handle = packageName.replace( WORDPRESS_NAMESPACE, 'wp-' ).replace( BABEL_NAMESPACE, 'wp-' );
const handle = packageName.replace( WORDPRESS_NAMESPACE, 'wp-' );

return {
camelCaseName,
Expand Down

0 comments on commit e099cd6

Please sign in to comment.