[Bug]: Vite custom font scanning all available font files including node_modules
Describe the feature
Since there are some font files (e.g. icon font) already handled by other plugin, unplugin-fonts is no need to inject those files. It just need to inject the configurated fonts instead of inject every available font files inside the build.
It is suggested that adding an option to disable control custom font.
Update - it is a bug
Vite custom font scanning all available font files including node_modules file on build
Are the following code repeated? https://github.com/cssninjaStudio/unplugin-fonts/blob/a7e66d594e2c7e0a2cccfed7c15a069ffebb96c1/src/index.ts#L92-L102 https://github.com/cssninjaStudio/unplugin-fonts/blob/a7e66d594e2c7e0a2cccfed7c15a069ffebb96c1/src/index.ts#L126-L136
I'm hitting this as well, and this results in console warnings in my app, due to adding preload directives for fonts that are only used in async chunks that are not loaded with the app. This happens because the current code generates preload directives for all fonts in the bundle rather than only fonts included via custom which is undesirable IMHO.
if you don't use custom fonts a quick fix is
UnpluginFonts({
...
custom: {
families: [],
preload: false,
},
}),
The proper way is probably to use linkFilter, but it's not in the docs