I realized that the problem is occuring because my project was hosted in a local directory, and the file loading mechanism only works when its hosted on a server. I did not know this, I thought file loading happens on local directories too