Font Optimization is not fully working
See original GitHub issueVerify canary release
- I verified that the issue exists in Next.js canary release
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 21.4.0: Fri Mar 18 00:46:32 PDT 2022; root:xnu-8020.101.4~15/RELEASE_ARM64_T6000
Binaries:
Node: 17.8.0
npm: 8.5.5
Yarn: 1.22.18
pnpm: N/A
Relevant packages:
next: 12.1.4
react: 18.0.0
react-dom: 18.0.0
What browser are you using? (if relevant)
Chrome 100.0.4896.60
How are you deploying your application? (if relevant)
Vercel, Heroku
Describe the Bug
Font Optimization is not working fully.
This happened after upgrading to React@18.
I have set up the project and using _document.tsx would like to add some of Google Fonts.
This is what it looks like in _document.tsx.
This is what it should look like after deployment.
However, this is what it looks currently like after deployment.
The href
is turned to data-href
after font optimization. But, link
is not turned to style
.
Expected Behavior
Font Optimization should work.
To Reproduce
Since it appears in individual projects, it is normal in most cases. So it’s hard to reproduce. I tried, but I can’t reproduce it by creating a new project.
Issue Analytics
- State:
- Created a year ago
- Reactions:11
- Comments:14 (2 by maintainers)
Top Results From Across the Web
First impressions on Next.js Automatic Font Optimization
Despite the name, currently it only works for Google Fonts loaded from fonts.googleapis.com . It does not work with other sources, including eg....
Read more >Optimize WebFont loading and rendering - web.dev
This post explains how to load WebFonts to prevent layout shifts and blank pages when WebFonts are not available when the page loads....
Read more >A Guide to Web Font Optimization
Learn how to better optimize the delivery of your fonts in this comprehensive, hands-on guide.
Read more >8 Font Loading Strategies to Improve Your Core Web Vitals ...
Find the best font loading techniques to optimize your site's performance and pass your Core Web Vitals. Apply them manually or using ...
Read more >How to use Font Optimization in Nextjs 13?
It does not work with other font providers. If you use any other font, ... You can use any google font in nextjs...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I am also experiencing the same issue. This problem started after upgrading my project to React 18.0.0.
Hi @huozhi
I can confirm that this issue has been resolved in
next@12.1.7-canary.5
.Thanks