skip to Main Content

I am using Angular 9.1.3 as framework and apache as server for my app.
After building new version of angular application I’ve started receiving this error in chrome:

Failed to load module script: The server responded with a non-JavaScript MIME type of “text/html”. Strict MIME type checking is enforced for module scripts per HTML spec.

It is working fine with firefox. I’ve checked the response header in chrome and indeed type is “text/html”, where it should be “application/javascript”.

HTTP/1.1 200 OK
Date: Fri, 22 May 2020 12:55:19 GMT
Server: Apache/2.4.6 (CentOS)
Last-Modified: Mon, 18 May 2020 10:30:55 GMT
ETag: "341-5a5e9a86975c0"
Accept-Ranges: bytes
Content-Length: 833
Content-Type: text/html; charset=UTF-8

Previous version of application has correct type of this file, so I have probably added something to angular app that couses this error. How can I force this type to be “application/javascript” ? Where is it defined ?

2

Answers


  1. Chosen as BEST ANSWER

    The solution was to clean the cache (ex. disable cache in network tab) not just code reload (ctrl + r).


  2. My solution was to clear cache on cloudflare

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search