Skip to content

Commit

Permalink
Do not bundle react in the jsx runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed May 15, 2024
1 parent afcdcd8 commit 1307b7f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/client-assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ function gutenberg_register_vendor_scripts( $scripts ) {
$scripts,
'react-jsx-runtime',
gutenberg_url( 'build/react-jsx-runtime/index.min.js' ),
array(),
array( 'react' ),
'18'
);
}
Expand Down
11 changes: 11 additions & 0 deletions tools/webpack/development.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,18 @@ module.exports = [
},
plugins: [
new DependencyExtractionWebpackPlugin( {
injectPolyfill: false,
useDefaults: false,
requestToExternal: ( request ) => {
if ( request === 'react' ) {
return 'React';
}
},
requestToHandle: ( request ) => {
if ( request === 'react' ) {
return 'react';
}
},
} ),
],
},
Expand Down

0 comments on commit 1307b7f

Please sign in to comment.