magesuite / magepack

Next generation Magento 2 advanced JavaScript bundler.
Open Software License 3.0
437 stars 91 forks source link

Bundling and PageSpeed Insight / Lighthouse v7 #100

Open stephansteiner opened 3 years ago

stephansteiner commented 3 years ago

I was using magepack with big success in 2020, but apparently Google PageSpeed / Lighthouse v6 made it once more harder to get a big performance boost from bundling. Funny enough, when bundling is enabled, performance score drops by almost 10 points and google pagespeed complains about bundled javascript. If I disable bundling, google is suggesting baler to bundle javascript (duh!). Did you notice a drop in performance score since November 2020 or is it just me?

frno-morita commented 3 years ago

Lately Google have been putting more emphasis on the new scores LCP (Largest Contentful Paint; currently weighted at 25% of total score), Total Blocking Time (currently weighted at 25% of total score) and CLS (Cumulative Layout Shifts; currently weighted at 5% of total score).

Mainly Total Blocking Time will measure the time the browser is prevented to do other stuff in the Browser Event Loop because of long running JavaScripts; bundling a lot of stuff can greatly impact this score negatively.

LCP is mostly affected by if you load the first large image (or in best case you only have text as above-the-fold important content); this can be impacted as well if you have long running JavaScript such as some bundle configurations run before images are loaded (this can be a bit mitigated by preloading the first image specifically but in my experience you have to be careful of loading the bundles too early).

We do not use this module but I thought it could be good to share some experience and bundling is not the main way to gain FE-performance nowadays. You should focus more on loading resources when they are needed and also look into loading them with the Idle Queue approach: https://github.com/GoogleChromeLabs/idlize.

Hope this sheds some light on the situation you are experiencing. Also a link to new Google measurement explanations: https://web.dev/performance-scoring/?utm_source=lighthouse&utm_medium=devtools

frostitution commented 1 year ago

In 2023 is it still useful to run Magepack? Are we better off letting Magento do things normally and instead plan to build for a different environment like Hyva instead?

We have been using Magepack for the past year or so but Google is still complaining about the bundled file, which is enormous itself. Is it better to just stop using Magepack and go back to the default Magento setup (sans the bundling)?