fix(module): preload global fonts - #856
Conversation
commit: |
📝 WalkthroughWalkthroughGlobal font processing now determines preload eligibility through a shared Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
The failing
|
9325c84 to
5540069
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #856 +/- ##
==========================================
+ Coverage 68.01% 69.40% +1.39%
==========================================
Files 9 9
Lines 297 304 +7
Branches 67 71 +4
==========================================
+ Hits 202 211 +9
+ Misses 78 77 -1
+ Partials 17 16 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Additional checks needed or all good? @danielroe |
Resolves #834
resolves #860
What
Global fonts (
global: true) are never preloaded, even withpreload: trueset.Why
The normal font-preload path runs through
shouldPreload, which feeds intofontMapand finally intobuild:manifest. Thenuxt-fonts-global.csstemplate, however, only generates the@font-facerule and skips this process entirely, so global fonts never enter the preload map.How
I extracted
shouldPreloadinto a shared function and collect the top-priority font intofontMap, using the font-family name as the key. This letsbuild:manifestcorrectly attach the font to the entry chunk. As a result, global fonts are preloaded as expected.Testing
I verified the issue is fixed in a production build, and the existing snapshot now includes
/font-global.woff2.