In this tutorial, Today I will explain to how to exclude specific file from JS Bundling in Magento 2. In Magento 2, to reduce number of Javascript file request, This bundling feature is available. It will be merge all JS file into one JS file and execute that only 1 JS file.
Now, If you want to exclude specific JS file from Bundling then, you need to follow below steps to exclude that file.
You may also like this :
- How to Set Fotorama Gallery Thumbnail as Vertical in Magento 2
- How to Add Custom LESS File in Custom Theme in Magento 2
Let’s assume that you have created custom theme. Now, You need to add this below code inside exclude tag in app/design/frontend/RH/Custom/etc/view.xml file :
<exclude>
<!-- To exclude whole directory -->
<item type="directory">RH_Helloworld::js</item>
<!-- To exclude specific file -->
<item type="file">RH_Helloworld::jquery/jquery.min.js</item>
</exclude>
Now, this file and directory will be not merge in JS Bundling. You can add multiple files and directories based on your requirement inside exclude tag.
That’s it !!!
I hope this blog is easy to understand about how to exclude specific file from JS Bundling in Magento 2. In case, I missed anything or need to add some information, always feel free to leave a comment in this blog, I’ll get back with proper solution.
Keep liking and sharing !!