There are several unused JS files which we do not use on the homepage. JS files are:

  1. jquery/ui-modules/datepicker.js
  2. jquery/ui-modules/timepicker.js
  3. moment.js
  4. jquery/ui-modules/sortable.js
  5. jquery/spectrum/spectrum.js
  6. mage/calendar.js

How can we remove all these unused JS from specific pages like home page.

I tried to remove tag in xml but It did not work. It seems it is added in dependency in jquery-ui

  • in which xml file, you have tried – Sathishkumar Dec 15 '20 at 8:20
  • I tried cms_index_index.xml as well as also checked for view.xml inside theme @Sathishkumar – Sameer Bhayani Dec 15 '20 at 9:25
  • basically you can't do that. Because this is requireJS dependency mechanism. You can't remove it when it already required somewhere in the code . The only way that you can determine which file should be call instead call all of it. This mean reduce less js file request to server – mrtuvn Dec 31 '20 at 18:46
  • @mrtuvn thanks.. you are right – Sameer Bhayani Jan 4 at 6:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.