From 8d31955f4d5ef25446b703452bce7f2a7c62b38a Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Mon, 20 May 2024 09:37:20 +0100 Subject: [PATCH] Switch to externals --- tools/webpack/vendors.js | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/tools/webpack/vendors.js b/tools/webpack/vendors.js index b06df0d8ee6c0..d21c029f6c397 100644 --- a/tools/webpack/vendors.js +++ b/tools/webpack/vendors.js @@ -3,11 +3,6 @@ */ const { join } = require( 'path' ); -/** - * WordPress dependencies - */ -const DependencyExtractionWebpackPlugin = require( '@wordpress/dependency-extraction-webpack-plugin' ); - const importedVendors = { react: { import: 'react', global: 'React' }, 'react-dom': { import: 'react-dom', global: 'ReactDOM' }, @@ -40,22 +35,12 @@ module.exports = [ }, }, - plugins: [ - new DependencyExtractionWebpackPlugin( { - injectPolyfill: false, - useDefaults: false, - requestToExternal: ( request ) => { - if ( name !== 'react' && request === 'react' ) { - return 'React'; - } - }, - requestToHandle: ( request ) => { - if ( name !== 'react' && request === 'react' ) { - return 'react'; - } - }, - } ), - ], + externals: + name === 'react' + ? {} + : { + react: 'React', + }, }; } ); } ),