Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of “text/html”

This error usually happens because you deployment was into a subfolder, so it seems like Angular is fetching you app directly from your base URL, so your html is found when you go to your domain.com/mysubfolder/index.html, but as the Angular fetches your resources from domain.com/index.html instead of domain.com/mysubfolder/index.html; I’m pretty sure this is the cause of your issue. You can resolve it building your app with:

ng build --prod --base-href mysubfolder

Leave a Comment

tech