magento / m2-devtools

Helpful in-browser debugging/inspection tools for the Magento 2 Front-End
Open Software License 3.0
170 stars 48 forks source link

Add additional bundle grouping options #42

Open aligent-lturner opened 5 years ago

aligent-lturner commented 5 years ago

This issue is a:

Environment

Question Answer
Magento version 2.x

Description

Let me preface this by saying I'm not 100% sure on this, but this is my understanding of the situation:

Currently, any module used in more than one page gets added to the single "shared" bundle. However, this might end up with modules used only on the PDP and PLP (for example) being loaded on every page. I'm sure it wouldn't be simple to implement, but it would be useful to be able to produce additional bundles, such as a "catalog" bundle for modules common to PDP and PLP, a "shipping" bundle for modules common to cart and checkout, etc.

Expected result:

"shared" bundle reduced in size, with additional bundles for common functionally. In theory, this would provide a more optimal set of modules for each page.

Possible solutions:

Either allow the user to link pages, or work from a pre-defined set of linked pages.

DrewML commented 5 years ago

Thanks for getting the discussion started @aligent-lturner! Going to drop in some comments from @Januszpl as well:

image

I'm a bit unsure of what the efficacy of something like this would be. In some situations, if done wrong, this could make things a bit worse. My guess is that it would be a benefit in the scenario that those "2-page modules" are on the larger side, but chunking off few kilobyte bundles for those "2-page modules" would likely have similar or slightly worse performance (due to extra round trip + weaker gzip compression).

Having said all that, it's impossible to know without trying it out and running some traces with some real stores.

Would someone be interested in manually-tweaking a config file and doing some profiling?