because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.css
主要沒有找到對應的Javascript 文件當成text/html 解析了,緣由是項目使用資源壓縮html
解決辦法:json
一、找到項目bundleconfig.json 文件 配置生產環境與開發環境所調用的JS、CSSapp
{
"outputFileName": "wwwroot/css/site.min.css",
"inputFiles": [
"wwwroot/css/site.css"
]
},
{
"outputFileName": "wwwroot/js/site.min.js",
"inputFiles": [
"wwwroot/js/js.css"
]
}
二、cshtml 文件視圖中經過 Environment 標籤,分別定義開發、預演和生產環境加載對應的資源文件。spa
<environment names="Development"> <link rel="stylesheet" href="~/css/site.css" /> <script src="~/js/site.js" asp-append-version="true"></script> </environment> <environment names="Staging,Production"> <link rel="stylesheet" href="~/css/site.min.css" asp-append-version="true" /> <script src="~/js/site.min.js" asp-append-version="true"></script> </environment>