Astro 7 Native Fonts 依赖 jsDelivr CDN
Astro 7 Native Fonts 的 fontsource provider 强制从 cdn.jsdelivr.net 拉字体,国内网络不可达导致 dev/build 崩溃。用 @font-face 本地化解决。
- Astro
- 字体
- CDN
现象
dev server 首启崩溃 [CannotFetchFontFile],Astro 7 Native Fonts API 从 cdn.jsdelivr.net 拉 Inter 超时。
修复
- 弃 fonts API(
fontProviders),用 CSS@font-face直引本地 woff2(复制自 @fontsource-variable/inter 包) - 中文回退系统字体栈
验证
- dev + build 双过
- 浏览器
document.fonts.status = loaded,CDN 请求数 0