nuxt / fonts

Plug-and-play web font optimization and configuration for Nuxt apps.
https://fonts.nuxt.com
MIT License
445 stars 7 forks source link

Does not respect app.baseURL in inline font-face rules in production #341

Closed Luca-Sett closed 2 days ago

Luca-Sett commented 1 week ago

Setting baseURL: "/base-url/" does not seem to work in production (works as expected in development).

Development

@font-face {
  ...
  src: local("Playfair Display Variable"), url("/base-url/_fonts/nuFiD-vYSZviVYUb_rj3ij__anPXDTjYgEM86xRbPQ-OBdH44Wijn.woff2") format(woff2);
  ...
}

Image

Production

@font-face {
  ...
  src: local("Playfair Display Variable"), url(/_fonts/nuFiD-vYSZviVYUb_rj3ij__anPXDTjYgEM86xRbPQ-OBdH44Wijn.woff2) format(woff2);
  ...
}

Image

Minimal reproduction

Repo: https://github.com/Luca-Sett/font-test Live URL: https://font-test-beta.vercel.app/base-url/

nhedger commented 2 days ago

I'm experiencing the same issue.

In my case, I'm pre-rendering the whole site using npm run generate.

Luca-Sett commented 1 day ago

Thanks @danielroe 🙏 Confirming that this is fixed in the above reproduction!