Wix velo masterPage dosn't run code

Hello Everyone.

Here is the issue:
My website ran fine until recently when i realised that the code in my masterPage.js LOADS, BUT the code on the page doesn’t get executed.

The code is supposed to count and refresh the quantity of items in the cart collection every time the user switches from page to page.

So far I have tried everything. I have even commented out all the code and put simple console.log(“Master Page”); statement inside $w.onReady(function () {}), the console.log statement doesn’t execute.

It doesn’t run either in Preview Mode nor Published Mode.

Below is the copy of the code in the masterPage.js:

import { CountTotalQtyInCart } from ‘public/GlobalFunctions.js’
import wixLocation from ‘wix-location’;
import wixWindow from ‘wix-window’;

$w.onReady(function () {
//CountTotalQtyInCart();
console.log(“Master PAGE”);

/*$w('#btnCart').onClick((event) => {
  wixLocation.to("/cart");  
});*/

});

This community is my last hope. Please help.

Hmmm, that is weird. Just a suggestion: have you tried checking your site events log in your site’s dashboard to see if any backend errors come up?

Site Dashboard → Developer Tools → Logs → Site Events

I’ve been able to troubleshoot better using the site log to uncover what’s going on.