Magento 2 Developement

Magento 2 Bundle and Merge JavaScript Modes — Why Better To Enable Separately

Magento 2 Bundle and Merge JavaScript Modes can improve performance of your eCommerce website dramatically. But should you enable them simultaneously or separately?

While supporting our Slider Revolution Extension for Magento 2 we found JavaScript error on clients website. This problem was related to both merge and bundle javascript options enabled. In this configuration slider scripts can work unstable as it can break Require.js loaded dependencies. And as Magento 2 developers shared it is not recommended to enable both merge and bundle options same time. As they are pointed to optimize scripts loading in different way and purpose working together they can decrease positive performance effect of each other and cause problem with scripts on complicated apps. So we recommend to keep only merge or bundle modes enabled depending which one gives you better improvements but not both at the same time. Now we have disabled bundling and leave merge enabled and slider works on both front and backend.

In recent discussion with Magento team front end developers they explained that Bundle is used to optimize loading of dynamic required scripts that use Require.js. And merge option is used to speed up loading of old way embedded scripts. When both Magento 2 Bundle and Merge modes are enabled it can lead to unstable work and decrease effect of each separate mode. In future they are going to restrict enabling of both conflicted modes same time so it is advised not to use them together.

It is not recommended to turn all of the JS tweaks at once. As some of them are targeted to different aspects of optimization enabling both can bring in instability and decrease of performance instead of performance increase. This is about Merge and Bundle mode. Discussed with Magento developers they share that enabling of this options same time will be deprecated and disabled in future. So you need to consider enabling Merge or Bundle mode not both of them at once.

Leave a Reply

Your email address will not be published. Required fields are marked *