当我尝试加载我的主页时,出现以下错误并且页面是空白的。
main-es2015.5ff489631e1a2300adb7.js:1 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.
runtime-es2015.2c9dcf60c8e0a8889c30.js:1 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.
vendor-es2015.02ac05cd7eee1cf62f5a.js:1 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.
这在之前是能够正常工作的,在开发环境下使用 ng serve
时也能够正确运行。问题出现在从服务器上运行代码时。当我使用开发工具检查时,它显示的是 content-type
和 text/html
而不是 application/javascript
。如何解决?需要从服务器设置什么吗?