为什么Angular 5和NGinx无法提供javascript和css文件? MIME类型不是有效的Javascript。 SyntaxError:意外令牌:数字文字
我收到Angular 5 - typescript和Nginx服务器的错误。
控制台错误
The script from “https://my-server.com/organizations/inline.15670a33298d01750cb3.bundle.js” was loaded even though its MIME type (“text/html”) is not a valid JavaScript MIME type
SyntaxError: unexpected token: numeric literal
Javascript文件还下载了index.html的内容。另外,当我在页面“https://my-server.com/organizations”并刷新浏览器时,我被发送到“https://my-server.com/organizations/organizations”网址。
我的解决方案只是改变index.html中的基本href标签
<base href=""> <-- wrong
至
<base href="/"> <-- right
就是这样,nginx.conf或其他任何内容都没有变化。