Next.js Discord

Discord Forum

font not working

Answered
Shaurya posted this in #help-forum
Open in Discord
import "@styles/main/globals.css"
import Nav from "@/components/main/nav"
import { Montserrat } from "next/font/google"

const montserrat = Montserrat({ subsets: ["latin"] })

export default function RootLayout({
  children,
}: {
  children: React.ReactNode
}) {
  return (
    <html lang="en">
      <body className={montserrat.className}>
        <Nav />
        {children}
      </body>
    </html>
  )
}
why isn't the font working?
I didn't change anything but it's suddenly showing the fallback font
Answered by riský
also try new browser (/clear cache for page)
View full answer

10 Replies

is the file downloaded in dev tools (network), any errors in server console, and any confliting syles for fonts in CSS
and in the [docs](https://nextjs.org/docs/app/building-your-application/optimizing/fonts#google-fonts), they mention "variable fonts", is this font one of them?
@riský is the file downloaded in dev tools (network), any errors in server console, and any confliting syles for fonts in CSS
yes the file is downloaded, no errors in console, I've set the font only here not in css
and dev or pod mode?
dev mode
try prod and see if it works...
but it should work
also try new browser (/clear cache for page)
Answer
clearing cache works
@Shaurya clearing cache works
lol why does this have to be the cause of many things (but always forgotten about) 😭