I am optimizing the page speed of my Magento 2 frontend. Everything is logically so far... CSS files can be removed through XML, everything should be minified, lazy loaded and so on.

BUT: The size of all javascript files that are loaded is 12 MB (!!!). That is insane, sorry. There is so much unused crap loaded, like:

unused JS files

datepicker.js, timepicker.js, spectrum.js, tinycolor.js and so on... are just a few examples.

I know, the Magento 2 ui component / model structure is complicated, but how can i prevent all this JS files from beeing loaded? They are not used and i have no idea, how to prevent this unneccesary bytes from destroying my complete page speed.

I just want to remove this JS-files or complete modules like removing CSS-files. Can anyone help me with an example?

Thank you.

2 Answers 2


hey found temporal solution, take a look at the bottom of github there is description. (haxor211 - yea I know)

Here is the answer https://community.magento.com/t5/Magento-2-x-Programming/Remove-JS-files-from-beeing-loaded-through-require-js/m-p/460255#M11896

And here is the issue that was opened 1 year ago as time of writing this... https://github.com/magento/magento2/issues/24830

  • could you re-post the answer here because it seems deleted from the above url!
    – aimiliano
    Feb 11, 2021 at 13:24

Late answer for anyone who needs this, just create your own requirejs-config.js and override the path for that file to an empty js or if you want to replace it with something else, maybe another version, just replace it with the newer version in your theme/modules.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.