Update admin webpack config to resolve wp.components.ui

This commit is contained in:
Chi-Hsuan Huang 2022-04-28 17:22:27 +08:00
parent 4a6c3300aa
commit 5063dc3640
1 changed files with 8 additions and 1 deletions

View File

@ -165,7 +165,14 @@ const webpackConfig = {
// We reuse this Webpack setup for Storybook, where we need to disable dependency extraction.
! process.env.STORYBOOK &&
new WooCommerceDependencyExtractionWebpackPlugin(),
new WooCommerceDependencyExtractionWebpackPlugin( {
requestToExternal( request ) {
if ( request === '@wordpress/components/build/ui' ) {
// The external wp.components does not include ui components, so we need to skip requesting to external here.
return null;
}
},
} ),
// Reduces data for moment-timezone.
new MomentTimezoneDataPlugin( {
// This strips out timezone data before the year 2000 to make a smaller file.