我将每当您通过dotnet new blazorwasm
. 起初它工作正常,但是当我添加 webpack 来构建我的 SASS 文件时,一旦它被部署到 Azure SWA,它就会向我显示这个错误,上面写着:
Refused to apply style from <URL> because its MIME type ('text/html') is not a supported stylesheet MIME type
在 Blazor 生成的 CSS 文件和_framework/blazor.webassembly.js
文件上;这很有趣,因为这些文件应该是 Blazor 生成的默认文件。
此外,在开发工具上查看的 MIME 类型对于这两个文件显示不正确,但在我添加 webpack 之前它们曾经具有正确的 MIME 类型。
webpack生成的CSS文件创建成功,可以在浏览器上查看。我还使用 SWA cli/emulator 测试了dotnet publish
应用程序的版本,但没有遇到错误。