fix: resolve next/font/local loading issues #81
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi, @valentinpalkovic !
I've applied the same fix from #32998 to the Vite plugin and discovered additional bugs that needed to be addressed.
Summary
This PR fixes two critical bugs that prevented local fonts from loading correctly in development mode with
next/font/local.Changes
1. Fix: Support top-level weight/style in next/font/local with string src
2. Fix @fs URL formatting and CSS syntax in @font-face (new bug) ✨
Commit: fix: add slash separator and semicolon in @font-face CSS
Issues Fixed:
Missing slash between
@fsprefix and font path/@fsC:/path/to/font.woff2→ 404 error/@fs/C:/path/to/font.woff2→ 200 (works correctly)Missing semicolon after
srcproperty in@font-faceruleFiles Changed:
src/plugins/next-font/local/get-font-face-declarations.tsBefore:
After:
Test Result for second issue
💡 1. load font with next font local like under:
❌ before add
/after@fs✅ after add
/after@fs💡 2. load font with next font local like under:
❌ before add
;after src value & add/after@fs✅ after add
;after src value & add/after@fs