Could not resolve font face for SFMono-Regular from 0 provider. provider.resolveFontFaces is not a f

安装Nuxt4时,如果安装了@nuxt/ui或@nuxt/fonts,那大概率会出现google fonts加载或SFMono-Regular的问题,按下面的方法可以解决.

// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
  compatibilityDate: '2025-07-15',
  devtools: { enabled: true },

  modules: [
    '@nuxt/eslint',
    '@nuxt/image',
    '@nuxt/scripts',
    '@nuxt/ui'
  ],
  fonts: {
     injectFontFace: false,
     providers: [
    {
      name: 'bunny',
      url: 'https://fonts.bunny.net', // 替代 Google Fonts
    },
  ],
  }
})

其中的重点是:

fonts: {
   injectFontFace: false,
   providers: [
  {
    name: 'bunny',
    url: 'https://fonts.bunny.net', // 替代 Google Fonts
  },
],
}


复制内容


评论


乖,登录后才可以留言! 登录

Copyright © 2020-2023 春藤技术,春藤建站 All Rights Reserved
备案号:豫ICP备20020705号 公网安备 51LA统计