[Bug]: Console Warning : Resource was preloaded but not used within a few seconds
Demo URL
No response
What happened?
I set up a FontSource like described within the ReadMe. In particularly I used the variable fontsource "@fontsource-variable/source-serif-4": "^5.0.19"
This Warning shows only if the app is build. Within development this warning does not appear.
I don't know if this is related to https://github.com/cssninjaStudio/unplugin-fonts/issues/64 or not; this is why I upvoted/promoted that issue.
vue v3.4.27
vite v5.2.11
unplugin-fonts v1.1.1
Reproduction steps
- install unplugin-fonts v1.1.1
- install fontsource (e.g. @fontsource-variable/source-serif-4)
- setup unplugin-fonts to use fontsource within vite.config.mjs
Unfonts({
fontsource: {
families: ["Source Serif 4 Variable"],
},
}),
-
import unfonts style within main.js
import "unfonts.css"; -
use font somewhere within app
html {
font-family: "Source Serif 4 Variable", sans-serif;
}
Relevant log output
The resource [URL *.eot, *.woff2, *.woff, *.ttf] was
preloaded using link preload but not used within a few seconds from the
window's load event. Please make sure it has an appropriate `as` value and
it is preloaded intentionally.
What browsers are you seeing the problem on?
Firefox, Microsoft Edge, Other
What is your operating system?
Windows, Linux
I'm seeing this issue in default Vuetify installation. Haven't change anything related to fonts whatsoever.
Related to https://github.com/cssninjaStudio/unplugin-fonts/issues/74
Can confirm this is problematic. It should not mark everything as preload and at least give the user the ability to change whether fontsource fonts are preloaded.
As stated here https://github.com/cssninjaStudio/unplugin-fonts/issues/74#issuecomment-2839262656, a workaround is to add preload: false
UnpluginFonts({
...
custom: {
...
preload: false,
},
}),