The default version of bundling lies in the fact that an entire set of files is loaded on each webpage, such as checkout, product and category page, etc.
According to the Magento documentation, there’re two main ways to put it into practice:
- Manual adjusting based on RequireJS optimizer;
- Using the Magento_Baler Module.
The first option is quite challenging and time-consuming, and it involves manual configuration for each bundle.
The Magento_Baler module uses a similar approach but involves automation. So it’s an improved and upgraded version of the first method, which has a high potential for further development and usage among engineers. Currently, the module is in the early alpha-testing stage, is not stable, and contains a range of bugs.
It merely allows selecting a theme for which you need to launch bundling and start rendering. There is a pre-installed set of webpages, and after generation, you’ll receive more scripts connected to the webpage than through M2DevTools. You could also use another option—Magepack.
Besides, we’ve already used it on the Magento 2.3.4 stores, and it works pretty well. There, the main idea is that you specify links to webpages, such as homepage, catalog, product, and bundling is generated based on these links. At the course of generating, the tool also involves the checkout stage and shopping cart. One command generates build.js, and the second one launches the bundling itself.