Remove JS files from beeing loaded through require-js
-
14-04-2021 - |
Question
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:
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.
No correct solution
OTHER TIPS
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