jrief / django-formset

The missing widgets and form manipulation library for Django
https://django-formset.fly.dev/
MIT License
317 stars 30 forks source link

Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec. #116

Closed parice02 closed 6 months ago

parice02 commented 6 months ago

Hello! I get this error message when I go into production. I followed the installation steps correctly (I think). But the browser keeps giving me this error.

I've just migrated to 1.3.8 This is the first time I've encountered this error since I started using this library. I've tried most of the solutions on stackoverflow without success.

jrief commented 6 months ago

Your browser probably attempts to load one of the JavaScript modules during runtime. That script might be named chunk-Z3HLVUBI.js or something similar.

Could you please open the devtools of your browser and open the network tab. Then load the page. In your network activity tab, you should see many JS files loading. Check their response headers. If Content-Type is not application/javascript your webserver presumably is misconfigured.

parice02 commented 6 months ago

When I look in the DevTools, I notice that django-formset.js is loaded with the Content-Type text/html. Screenshot from 2024-03-05 17-20-24

jrief commented 6 months ago

When I look in the DevTools, I notice that django-formset.js is loaded with the Content-Type text/html.

well, then you have the culprit.