Blog

Magento 2: Override file of lib folders

In Magento2, if you want to change the code of the js files located in the lib directory. Then we should not modify the core js files located in lib folder.

Then how to make changes to it is to override the lib js file. Here to explain this in better way, lets take example of lib/web/mage/menu.js

You can override it by placing it under your custom theme on the below path.

/app/design/frontend/[Vendor]/[Theme]/web/mage/menu.js

After placing this file, please run the below commands to reflect the changes.

  • Remove the folders present in :-
    • pub/static/frontend
    • var/view_preprocessed/pub/static/frontend
  • Then run this command : – php bin/magento s:s:d -f
  • and the last command is here: – php bin/magento c:f

Do comment below giving your feedback.

Leave a Reply

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