Search code examples
javascriptperformancemagentopagespeedmagento-2.3

Magento 2 load JS at the end


could somebody help me how/in which files can I edit the order of loading scripts? My product page (only the product page) is VERY slow, and I'm trying to load JS at the very end.

Thanks


Solution

  • if you have magento 2.3.2+ you can enable move javascript to bottom of page by following this steps

    Store > Configuration > Advanced > Developer > Javascript Settings and set yes for Move JS code to the bottom of the page

    Move JS code to the bottom of the page

    if you have older magento version you can use some extensions listed in github to deferejs loading like this one https://github.com/taoufiqaitali/magento2-defer-parsing-of-javascript