For example in requirejs-config.js I have this

var config = {
    map: {
        "*": {
            msapp : "Magento_Theme/js/msapp"

Then I notice that it compiles into msapp.min.js in the pub/static folder. And then when I visit the site and examine the network tab, it loads right away. Is there a way to delay loading that javascript file until for example 5 seconds has passed or the user has scrolled?

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.