nuxt: corrupted and missing assets in built vite app ('Failed to decode downloaded font')

Have same issue image


  • Operating System: Darwin
  • Node Version: v16.13.2
  • Nuxt Version: 3.0.0-27383920.81ee59c
  • Package Manager: npm@8.1.2
  • Bundler: Vite
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

The last release 3.0.0-27383920.81ee59c fixed the problem with images in /assets loaded from css url() now loaded correctly, but remains an issue with fonts loaded from /assets in css @font-face, i attach a screenshot of it: (Failed to decode downloaded font: / Failed to load response data)

Fonts loaded as:

/* assets/css/fonts.css */
@font-face {
  font-family: 'Noto-Sans';
  src: url('assets/fonts/noto-sans/NotoSans-Regular.ttf') format('truetype');
}
failed-to-decode-font

_Originally posted by @arb85 in https://github.com/nuxt/nuxt.js/issues/13250

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 25 (5 by maintainers)

Most upvoted comments

@danielroe that does it! maybe nuxi upgrade should clear that

yarn build is currupting font files.

Comparing the hashed asset file with the original. Font file no longer previews / loss of metadata / increased file size.

CleanShot 2022-01-24 at 21 52 28@2x

also no custom assetDir. i would like to post repros for nuxt issues based on my working repo but still need to check in with management on how much i can share, so i appreciate u @arb85 ❤️

@danielroe No custom assetDir for me, i’ll post a reproduction shortly

Thank You for your time (and for Nuxt!) It’s strange, it happens only with some font and only in build (in dev mode all fonts are displayed correctly) and after the upgrade. I have used the same fonts and they are all displayed correctly with previous releases of Nuxt, maybe it’s a Vite-related issue?

[ No issue with any other types of assets after today release, 3.0.0-27383920.81ee59c, before it also effects some .svg images used as background in css url() ]

I’ve done a clear version with:

$ npx nuxi init

that works well, so I’m trying to add packages one by one to see when the issue appears… then I’ll post the reproduction