When I load my node.js application using localhost, index.html’s script works properly:
<script src="/index.js" defer></script>
On the other hand, when I use render.com to load my app, index.html loads along with the css however the javascript doesn’t and this error appears in the console:
- GET https://blackjack-v7lr.onrender.com/index.js net::ERR_ABORTED 404 (Not Found)
- Refused to execute script from ‘https://blackjack-v7lr.onrender.com/index.js’ because its MIME type (‘text/html’) is not executable, and strict MIME type checking is enabled
Despite the location of the file being correct as evidenced by local host working, the online host doesn’t. Other htmls that dont use javascipt work though. How would I go about fixing this?
I tried using postman through the server based url (https://blackjack-v7lr.onrender.com/index.js) but that didn’t find the file either only when using localhost did it find it
I have tried also checking if .gitignore has index.js there as this would block render.com from being able to find the file but it is not in .gitignore