我正在嘗試從用 Go 編寫的服務(wù)器提供 Angular 應(yīng)用程序(Angular 8.2.14)。四處搜索后,我發(fā)現(xiàn)了以下片段,據(jù)說可以解決這個問題。func main() { http.ListenAndServe(":4000", http.FileServer(http.Dir(folderDist)))}其中folderDist是我構(gòu)建應(yīng)用程序的目錄。當(dāng)我在示例中導(dǎo)航到 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.我缺少什么?我已經(jīng)嘗試過這里建議的解決方案,但錯誤仍然相同。
1 回答

ABOUTYOU
TA貢獻1812條經(jīng)驗 獲得超5個贊
解決了。
顯然 Angular 8 的某些版本存在錯誤......
編輯tsconfig.json文件并將“target”行更改為“es5”。
"target": "es5",
進行“構(gòu)建”。
完畢!
- 1 回答
- 0 關(guān)注
- 159 瀏覽
添加回答
舉報
0/150
提交
取消