Skip to content

Possible reasons for occasional incomplete execution of javascript from a custom odule

I have developed a custom module for magento 2.4.6, which loads 3 javascript files through requirejs config.

var config = {
    map: {
        "*": {
            'Magento_Checkout/template/billing-address/details.html': 
            'Iwdata_AddressExt128e/web/template/billing-address/details.html'
        }
    },
    paths: {
        'leaflet': 'Iwdata_AddressExt128e/js/leaflet',
        'custom': 'Iwdata_AddressExt128e/js/custom',
        'Iwdatacustom_customer': 'Iwdata_AddressExt128e/js/Iwdatacustom_customer'
    },
    shim: {
        'custom': {
            deps: ['leaflet']
        },
        'Iwdatacustom_customer': {
            deps: ['leaflet', 'custom']
        }
    },
    deps: ['Iwdata_AddressExt128e/js/leaflet', 'Iwdata_AddressExt128e/js/custom', 'Iwdata_AddressExt128e/js/Iwdatacustom_customer']
};

It usually works, but occasionally some part of code execution seems not triggered somehow (rendering of some dynamic elements in checkout page), with no errors on screen or browser console. The relevant js files seem loaded (relevant js objects, variables are visible/accessible in Js console). I fixed even all insignificant minor errors/warnings in console. This issue is common in accessing through Safari (again its not so always), and occasionally can also seen with Chrome. We never experienced this with firefox.

Cleaned static files, cleared cache, even disabled cache. Still its happening some times.

Can you please guide me alternative approaches for fixing this issue. When there is not visible js errors.

Thanks and Best Regards

Indunil