-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[docs] Migrate to next/font for fonts loading
#20407
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Co-authored-by: Janpot <2109932+Janpot@users.noreply.github.com>
|
Deploy preview: https://deploy-preview-20407--material-ui-x.netlify.app/ Bundle size report
|
next/font for Google Fonts
Janpot
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot next/font requires swc, so no babel config
docs/pages/_document.tsx
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot don't cover this file,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted - removed _document.tsx and restored original _document.js in 66c7655
Co-authored-by: Janpot <2109932+Janpot@users.noreply.github.com>
Removed Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot for this to work, you'll need to update the @mui/monorepo depednency to latest, such that the last version of _document is used, the one that doesn't contain the font loading anymore |
Co-authored-by: Janpot <2109932+Janpot@users.noreply.github.com>
Updated @mui/monorepo to d5e68b88 (latest master) which includes the next/font changes in e8d66fc Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
next/font for Google Fontsnext/font for fonts loading
| subsets: ['latin'], | ||
| }); | ||
|
|
||
| export const fontClasses = `${inter.className} ${roboto.className}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
technically not being used, but I'm just replicating core _app.js for now
Ports mui/material-ui#47347 and mui/material-ui#47351 to eliminate render-blocking Google Fonts resources and improve Lighthouse performance scores.
Changes
next/font/google, exportfontClasses@mui/monorepoto latest version (d5e68b88) that includes the next/font changes from PR #47347The
_document.jsfile imports from the monorepo package, which now appliesfontClassesto the body tag and removes old Google Fonts link tags. Fonts are now optimized and self-hosted by Next.js instead of loaded from external CDN.Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.