We started facing this error in production after our devops team changed the webserver configuration by adding X-Content-Type-Options: nosniff
. Now, due to this, browser was forced to interpret the resources as it was mentioned in content-type
parameter of response headers.
Now, from the beginning, our application server was explicitly setting content-type of the js files as text/plain
. Since, X-Content-Type-Options: nosniff
was not set in webserver, browser was automatically interpreting the js files as JavaScript files although the content-type was mentioned as text/plain. This is called as MIME-sniffing. Now, after setting X-Content-Type-Options: nosniff, browser was forced to not do the MIME-sniffing and take the content-type as mentioned in response headers. Due to this, it did interpret js files as plain text files and denied to execute them or blocked them. The same is shown in your errors.
Solution: is to make your server set the content-type
of JS files as
application/javascript;charset=utf-8
This way, it will load all JS files normally and issue will get resolved.