我正在尝试从用 Go 编写的服务器提供 Angular 应用程序(Angular 8.2.14)。
四处搜索后,我发现了以下片段,据说可以解决这个问题。
func main() {
http.ListenAndServe(":4000", http.FileServer(http.Dir(folderDist)))
}
其中folderDist是我构建应用程序的目录。
当我在示例中导航到 localhost:4000 时,我在浏览器上收到以下错误:
runtime-es2015.js:1 Failed to load module script: The server responded with a non-JavaScript MIME type of "text/plain". Strict MIME type checking is enforced for module scripts per HTML spec.
styles-es2015.js:1 Failed to load module script: The server responded with a non-JavaScript MIME type of "text/plain". Strict MIME type checking is enforced for module scripts per HTML spec.
main-es2015.js:1 Failed to load module script: The server responded with a non-JavaScript MIME type of "text/plain". Strict MIME type checking is enforced for module scripts per HTML spec.
polyfills-es2015.js:1 Failed to load module script: The server responded with a non-JavaScript MIME type of "text/plain". Strict MIME type checking is enforced for module scripts per HTML spec.
vendor-es2015.js:1 Failed to load module script: The server responded with a non-JavaScript MIME type of "text/plain". Strict MIME type checking is enforced for module scripts per HTML spec.
我缺少什么?
我已经尝试过这里建议的解决方案,但错误仍然相同。
ABOUTYOU
相关分类