LH warns of "Warnings: A preload <link> was found for [...]" incorrectly, when using crossorigin="anonymous"
See original GitHub issueProvide the steps to reproduce
Using the following code at :
{/* Perf optimisation (preload normal and bold fonts because they're the most used) - See https://web.dev/uses-rel-preload*/}
<link rel="preload" as="style" href={'/static/fonts/NeuzeitGrotesk/font.css'} crossOrigin="anonymous" />
<link rel="preload" as="font" href={'/static/fonts/NeuzeitGrotesk/NeuzeitGrotesk-bold.woff'} type="font/woff" crossOrigin="anonymous" />
<link rel="preload" as="font" href={'/static/fonts/NeuzeitGrotesk/NeuzeitGrotesk-bold.woff2'} type="font/woff2" crossOrigin="anonymous" />
<link rel="preload" as="font" href={'/static/fonts/NeuzeitGrotesk/NeuzeitGrotesk-black.woff'} type="font/woff" crossOrigin="anonymous" />
<link rel="preload" as="font" href={'/static/fonts/NeuzeitGrotesk/NeuzeitGrotesk-black.woff2'} type="font/woff2" crossOrigin="anonymous" />
What is the current behavior?
Warnings: A preload <link> was found for “https://nrn-v2-mst-aptd-gcms-lcz-sty-c1-izza69ujx.now.sh/static/fonts/NeuzeitGrotesk/font.css” but was not used by the browser. Check that you are using the
crossorigin
attribute properly.
What is the expected behavior?
It shouldn’t throw such warning, the font is using crossorigin="anonymous"
, the link is valid.
Everything looks fine to me.
I didn’t have that issue before using the crossorigin
attribute. See previous report of previous deployment before this commit.
Issue Analytics
- State:
- Created 3 years ago
- Comments:13
Top Results From Across the Web
Preload Image in html gives warning message - Stack Overflow
Consider taking a look at crossorigin attribute. I expect it to work but I am seeing two downloads for the same resource(image). see...
Read more >Lighthouse and Pagespeed reporting "not-used" pre-loaded ...
I am trying to pre-load a web font as instructed, but both Lighthouse and Pagespeed tools give me the following warning: Warnings: A...
Read more >Preloading font doesn't work - GeneratePress
I thought that preloading fonts makes font-display: swap; unnecessary. ... the warning and have 0 font related CLS is to use a system...
Read more >Fix: Consider taking a look at crossorigin attribute - Beamtic
A preload for x is found, but is not used because the request credentials mode does not match. Consider taking a look at...
Read more >Node.js v19.3.0 Documentation
The following example does not throw an AssertionError because the primitives are compared using the == operator. import assert from 'node:assert'; // WARNING: ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, thanks for following up.
You were so close 😃
You don’t want
crossorigin
on your stylesheets.You do want
crossorigin
on your fonts.For reasoning see the MDN docs on preload
I would expect the below to preload everything correctly and pass Lighthouse.
There is actually 4 fonts, and they get loaded twice (with the warning shown in lighthouse):  mavenpro-bold.woff2 200 http/1.1 methodsmachine.loc font (index) 24.9 kB 28 ms mavenpro-regular.woff2 200 http/1.1 methodsmachine.loc font (index) 24.9 kB 9 ms mavenpro-black.woff2 200 http/1.1 methodsmachine.loc font (index) 24.7 kB 13 ms mavenpro-medium.woff2 200 http/1.1 methodsmachine.loc font (index) 24.8 kB 17 ms mavenpro-bold.woff2 200 http/1.1 methodsmachine.loc font style-front-page-1599660170746.min.css 24.9 kB 35 ms mavenpro-regular.woff2 200 http/1.1 methodsmachine.loc font style-base-1599660170746.min.css 24.9 kB 33 ms mavenpro-black.woff2 200 http/1.1 methodsmachine.loc font style-base-1599660170746.min.css 24.7 kB 32 ms mavenpro-medium.woff2 200 http/1.1 methodsmachine.loc font style-base-1599660170746.min.css 24.8 kB 7 ms
And score is seriously degraded.