我使用 vue-create-app
创建了一个 Vue+Vuetify 项目。在我的本地系统中,Vuetify 工作正常,但在 Gitlab live server 上不起作用。并在实时应用程序中显示此错误消息:
"Refused to apply style from 'https://me.gitlab.io/css/chunk-vendors.16d7cb41.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled."
我在 Gitlab 中部署了该应用程序,而没有修改 vue-create-app
的锅炉代码。
最佳答案
我猜问题是该站点部署在 https://me.gitlab.io/<project-name>/
但生成的index.html包含绝对路径,例如/css/chunk-vendors.16d7cb41.css
.
如documentend here ,我通过编辑我的 vue-config.js
解决了添加:
module.exports = {
publicPath: process.env.NODE_ENV === 'production'
? '/<project-name>/'
: '/'
}
关于gitlab - Vue+Vuetify 应用程序中的 "Refused to apply style from {link} because its MIME type is not a supported and strict MIME checkinis enabled.",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64016895/