火箱托管中的Angular 8的MIME误差



i有一个Angular 8应用程序,该应用程序托管在Firebase上,并在客户端运行:go-astilectron(atterectron 0.30和Electron 4.0.1(。

问题是我在某些客户端中遇到了下面的错误(当角度代码加载时,它发生了,因此Actilectron只是显示一个空白页(:

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.
main-es2015.5a90aaf45a8347384655.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.

在某些情况下,我们设法通过重新加载页面来解决此问题,但是无论我做什么,该页面都不会加载。

我已经进行了一些研究,发现这可能会重新介绍给注册服务人员的申请,但这不是我的案例。

另外,由于我是使用firebase托管的静态站点,所以我没有做任何哑剧配置。

任何人可以帮我吗?

确保在index.htmlhead包括:

<base href="/">

请参阅:https://github.com/angular/angular-cli/issues/10325#issuecomment-399329033

当在未正确设置注册表MIME类型的Windows机器上运行Python服务器时,此错误也会发生。

请参阅:https://github.com/pallets/flask/issues/1045#issuecomment-42202749

我有这个问题。

转到Angular.js,然后检查"输出路径"的值。如果将其设置为" dist/your-project-name"之类的东西,请尝试将其更改为" dist/dist/redeploy,然后对您的网站进行硬刷新(ctrl f5(。

我通过简单地运行npm cache clear -f然后刷新浏览器来解决此问题。

希望这会有所帮助!

对我来说,空的缓存和浏览器的硬重新加载已经解决了问题。

最新更新