Reputation: 1
I have made a website which is running perfectly on localhost but when I uploaded it on the hosting platform freehosting using Filezilla, I am getting the error:
Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "". Strict MIME type checking is enforced for module scripts per HTML spec.
I am using the website freehosting.com to host my domain server. I uploaded the contents in public_html folder of the directory using Filezilla. As the website is not running and showing an error, freehosting.com doesn't show any logs.
I have created a .htaccess file and put
<IfModule
text/javascript js tsx
/IfModule>
but it is still not working. The content-type in the response header shows text/HTML.
The network tab shows 2 tabs
xxxx.com- Response contains index.html file
main.tsx- Response contains main.tsx file
I have included all details to the best of my knowledge which is required to answer the question. There are no debugging logs as I am only getting this error. And nothing else is shown.
My index.html file is
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/assets/images/logo.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>xxxx</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
Edit: The hosting service only allowed PHP and HTML type websites. That is why it was not working.
Upvotes: 0
Views: 68