Thanks for reporting, this is definitely not expected and I’ve created an issue: https://github.com/woocommerce/woocommerce-blocks/issues/7176
Hey there, @madjedo. Thanks for bringing this to our attention. In fact, this is not an issue, but the expected behavior of the Mini Cart block.
The reason why the Mini Cart block preloads those scripts, is to ensure they are ready when the shopper interacts with the Mini Cart, guaranteeing there is no waiting time between clicking the Mini Cart button and the Mini Cart drawer opening.
Regarding the performance considerations, allow me to point out a couple of things:
* the scripts are downloaded after the page is loaded and finished rendering
* they don’t block or slow down page rendering, and they shouldn’t affect negatively the performance of the page: they are downloaded in the background, but not executed
* once they have been downloaded once, the scripts will be in the browser cache, so in practice they are only downloaded on the first page the shopper visits
If you want to know more, this mechanism is explained in detail in this post: How does WooCommerce Blocks render interactive blocks in the frontend?
Hope that helps!
Thank you for your thorough response @aljullu
Though lazy loading, and other similar “tech” usually strike me as tricks instead then actual performance gains. One way or the other, the assets are still going to load.
And when you consider the number of users with old smartphones and slow 3G connections, this becomes an important issue. Especially when we are talking e-commerce and conversion rate optimization.
Since opening this ticket I have tested a few other cart plugins. And they all manage to load about 75% less resources then yours. And just from the looks, they seem to behave almost exactly the same as yours. Your plugin/block does however win out in ‘accessibility’.
I haven’t done a lot of more detailed testing on your mini cart block to understand where or why it needs all these assets. But I guess it’s coming from different libraries for javascript, CSS, and fonts. So I would encourage you to see what else could be done for performance other than just lazy loading because lazyloading is just lazy.
Other than that, your block works and looks just fine. It is also accessible, which is a huge plus for me.
Hi @madjedo
Since this is being discussed in GitHub, I’d suggest subscribing to the GitHub thread mentioned previously, to get updates about progress.