Skip to content

Commit

Permalink
Test DEWP's excludedExternals using react
Browse files Browse the repository at this point in the history
instead of lodash.
Avoid warnings and prepare for dropping lodash completely.

Addresses https://github.com/WordPress/gutenberg/pull/45948/files/e0d164967659fea61f769f876aa0c63010fbda62#r1262670308
  • Loading branch information
tomalec committed Jul 14, 2023
1 parent 8162381 commit 6c0863c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`DependencyExtractionWebpackPlugin Webpack \`bundled-packages\` should produce expected output: Asset file 'index.min.asset.php' should match snapshot 1`] = `
"<?php return array('dependencies' => array('wp-blob'), 'version' => 'e46beb725c995b0c555a');
"<?php return array('dependencies' => array('react', 'wp-blob'), 'version' => '8df4ae5a12b83b01dbc3');
"
`;

exports[`DependencyExtractionWebpackPlugin Webpack \`bundled-packages\` should produce expected output: External modules should match snapshot 1`] = `
Array [
Object {
[
{
"externalType": "window",
"request": "React",
"userRequest": "react",
},
{
"externalType": "window",
"request": Array [
"request": [
"wp",
"blob",
],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/**
* External dependencies
*/
import { isEmpty } from 'lodash';
import { ReactDOM } from 'react-dom';

/**
* WordPress dependencies
*/
import { isBlobURL } from '@wordpress/blob';

isEmpty( isBlobURL( '' ) );
isBlobURL( ReactDOM.version );
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.exports = {
},
plugins: [
new DependencyExtractionWebpackPlugin( {
excludedExternals: [ 'lodash' ],
excludedExternals: [ 'react-dom' ],
} ),
],
};

0 comments on commit 6c0863c

Please sign in to comment.