How to add rel=preload to improve lighthouse performance score
I keep having this error in the lighthouse audits and I can't find a workaround for it:
Consider using to prioritize fetching resources that are currently requested later in page load.
Its dramatically decreasing the performance score, so i am wondering if there is a way to add the preload attribute somehow?
Here is what I have in my nuxt config atm:
webfontloader: {
custom: {
families: ['GarnettMedium-Regular', 'Staff-Medium', 'Staff-Regular'],
urls: ['/fonts.css']
}
}
Any help would be highly appreciated! Thanks!
Any updates on this? Would be great to get any answer since the client is pushing us to fix that issue... :(
+1 CC: @manniL @Developmint
I fixed the issue with adding the link manually to "nuxt.config.js".
head: {
...,
link: [
{
rel: "preload",
as: "style",
href: "/fonts.css",
},
],
},
@mahapo This method doesn't load fonts for me. I am using Google fonts link on "nuxt": "^2.14.0".