Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c40987a

Browse files
fix(preset-web-fonts): handle errors during web fonts preflight fetch (#4912)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent 15b3478 commit c40987a

File tree

1 file changed

+6
-1
lines changed
  • packages-presets/preset-web-fonts/src

1 file changed

+6
-1
lines changed

packages-presets/preset-web-fonts/src/preset.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,12 @@ export function createWebFontPreset(fetcher: (url: string) => Promise<any>) {
129129
preflights.push(await importUrl(url))
130130
}
131131

132-
preflights.push(await provider.getPreflight?.(fontsForProvider, fetchWithTimeout))
132+
try {
133+
preflights.push(await provider.getPreflight?.(fontsForProvider, fetchWithTimeout))
134+
}
135+
catch (e) {
136+
console.warn(`[unocss] Web fonts preflight fetch failed.`, e)
137+
}
133138
}
134139

135140
const css = preflights.filter(Boolean).join('\n')

0 commit comments

Comments
 (0)