Fix crashes in mini-cart by externalizing the wc types package. (#46814)

This commit is contained in:
Sam Seay 2024-04-23 16:18:37 +08:00 committed by GitHub
parent 2ae56b2de2
commit 97595ce95d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 8 additions and 0 deletions

View File

@ -218,6 +218,7 @@ const entries = {
wcBlocksSharedContext: './assets/js/shared/context/index.js',
wcBlocksSharedHocs: './assets/js/shared/hocs/index.js',
priceFormat: './packages/prices/index.js',
wcTypes: './assets/js/types/index.ts',
// interactivity components, exported as separate entries for now
'wc-interactivity-dropdown':

View File

@ -19,6 +19,7 @@ const wcDepMap = {
'@woocommerce/blocks-checkout': [ 'wc', 'blocksCheckout' ],
'@woocommerce/blocks-components': [ 'wc', 'blocksComponents' ],
'@woocommerce/interactivity': [ 'wc', '__experimentalInteractivity' ],
'@woocommerce/types': [ 'wc', 'wcTypes' ],
};
const wcHandleMap = {
@ -32,6 +33,7 @@ const wcHandleMap = {
'@woocommerce/blocks-checkout': 'wc-blocks-checkout',
'@woocommerce/blocks-components': 'wc-blocks-components',
'@woocommerce/interactivity': 'wc-interactivity',
'@woocommerce/types': 'wc-types',
};
const getAlias = ( options = {} ) => {

View File

@ -0,0 +1,4 @@
Significance: patch
Type: fix
Fix crashes in the mini-cart when combined with product and filter blocks. Closes #46542.

View File

@ -50,6 +50,7 @@ final class AssetsController {
$this->register_style( 'wc-blocks-style', plugins_url( $this->api->get_block_asset_build_path( 'wc-blocks', 'css' ), dirname( __DIR__ ) ), array(), 'all', true );
$this->register_style( 'wc-blocks-editor-style', plugins_url( $this->api->get_block_asset_build_path( 'wc-blocks-editor-style', 'css' ), dirname( __DIR__ ) ), array( 'wp-edit-blocks' ), 'all', true );
$this->api->register_script( 'wc-types', $this->api->get_block_asset_build_path( 'wc-types' ), array(), false );
$this->api->register_script( 'wc-blocks-middleware', 'assets/client/blocks/wc-blocks-middleware.js', array(), false );
$this->api->register_script( 'wc-blocks-data-store', 'assets/client/blocks/wc-blocks-data.js', array( 'wc-blocks-middleware' ) );
$this->api->register_script( 'wc-blocks-vendors', $this->api->get_block_asset_build_path( 'wc-blocks-vendors' ), array(), false );