gitlab - Vue+Vuetify 应用程序中的 "Refused to apply style from {link} because its MIME type is not a supported and strict MIME checkinis enabled."

标签 gitlab vuetify.js mime-types stylesheet

我使用 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/

相关文章:

docker - 在 gitlab ci 中查找在 docker-compose 中运行的容器的 url/ip

linux - 全新安装后gitlab无法运行

javascript - 如何强制按钮在 vue.js 中保持在一行?

vue.js - Vuex mapActions、mapGetters 等...在同一个调用中混合命名空间和非命名空间操作/getters/mutations/state?

php - 上传 xls 或 xlsx 文件时出现 codeigniter,mime 类型错误

python - 内容类型 text/plain 的文件扩展名为 .ksh?

gitlab - 哪个上游项目触发了 GitLab CI 下游管道

git - Jenkins 与另一个分支 merge 后不会建立分支

image - 如何通过可视化设置轮播图片的大小

python - 在 python 中添加一个 mimetype