Refused to apply style from ‘XXX‘ because its MIME type (‘text/html‘) is not a supported stylesheet
完整报错信息是 Refused to apply style from 'http://localhost:8080/src/assets//css/reset.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled问题
·
完整报错信息是 Refused to apply style from 'http://localhost:8080/src/assets//css/reset.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled
问题就是这个文件的类型不是一个受支持的样式表,无法应用样式。
在 vue 项目中,在 src 的 assets 目录下设置了一些 css 文件,然后在 public 下的 index.html 中引入,启动项目出现了此问题。
解决方法:因为在 vue 项目中,public 和 src 目录是同级的,css 在 src/assets/css 下,index.html 在 public 目录下,将 css 文件移至 public/css 目录下
出现这个报错的原因不一定是这个方法,其他原因请大家再查阅资料。
如有错误,欢迎指正,谢谢!
以上内容仅供参考,欢迎大家讨论。
更多推荐



所有评论(0)