Home

Issue: 1508

Preloading hashed, static assets with rel="preload"

[issue link]

Hey there,

I wanted to add a link tag with rel="preload" for two fonts that I am using, so that the priority in which they are loaded is higher (especially when coming from a ServiceWorker, since they are currently prioritized as lowest — which slows down things).

I added this to my nuxt.config.js inside the link array, where all other links are:

{
  rel: 'preload',
  as: 'font',
  crossorigin: 'crossorigin',
  type: 'font/woff2',
  href: 'fonts/ApercuPro.woff2'
}

The problem I am experiencing is that the preloaded font is now being loaded twice, once the hashed version, the other time the raw, original one as can be seen here:

double-font-load

Ideally, only the hashed version of the file should be referenced inside href, just like Nuxt already does this with all other references to that particular file (e.g. url(/_nuxt/fonts/ApercuPro.5398148.woff2) inside style).

Sorry if I am missing something here and thank you for your feedback in advance. 😃 Been a happy user for a while now. ❤️ Also glad to help in any way, if I can!

This bug report is available on Nuxt.js community (#c1343)