Skip to content

Commit

Permalink
Switch to externals
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed May 20, 2024
1 parent b721029 commit 8d31955
Showing 1 changed file with 6 additions and 21 deletions.
27 changes: 6 additions & 21 deletions tools/webpack/vendors.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' },
Expand Down Expand Up @@ -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',
},
};
} );
} ),
Expand Down

0 comments on commit 8d31955

Please sign in to comment.