How to use Geist font on Nextra docs?
Answered
Sporting Lucas Terrier posted this in #help-forum
Sporting Lucas TerrierOP
I want to use [Geist](https://vercel.com/font#get) font on [nextra docs](https://nextra.site/docs)
I read the geist docs from [here](https://www.npmjs.com/package/geist?activeTab=readme) but it didn't help me!
I first tried to import this on the app/layout.js file but it didn't work, then I imported it on the pages/_app.js but it threw the error
I read the geist docs from [here](https://www.npmjs.com/package/geist?activeTab=readme) but it didn't help me!
I first tried to import this on the app/layout.js file but it didn't work, then I imported it on the pages/_app.js but it threw the error
SyntaxError: Cannot use import statement outside a moduleeAnswered by joulev
this is a bug of
localFont in nextjs. check this thread for workarounds: https://github.com/vercel/geist-font/issues/596 Replies
@Sporting Lucas Terrier I want to use [Geist](https://vercel.com/font#get) font on [nextra docs](https://nextra.site/docs)
I read the geist docs from [here](https://www.npmjs.com/package/geist?activeTab=readme) but it didn't help me!
I first tried to import this on the app/layout.js file but it didn't work, then I imported it on the pages/_app.js but it threw the error `SyntaxError: Cannot use import statement outside a module`e
this is a bug of
localFont in nextjs. check this thread for workarounds: https://github.com/vercel/geist-font/issues/59Answer
use it in
pages/_app.tsx. nextra doesnt use the app router so you dont need to use app/layout.tsx@joulev this is a bug of `localFont` in nextjs. check this thread for workarounds: https://github.com/vercel/geist-font/issues/59
Sporting Lucas TerrierOP
still getting the same error:
_app.jsx:
SyntaxError: Cannot use import statement outside a module_app.jsx:
import 'components/style.css'
import { GeistSans } from "geist/font/sans";
export default function MyApp({ Component, pageProps }) {
return (
<main className={GeistSans.className}>
<Component {...pageProps} />
</main>
)
}@Sporting Lucas Terrier still getting the same error: `SyntaxError: Cannot use import statement outside a module`
_app.jsx:
`import 'components/style.css'
import { GeistSans } from "geist/font/sans";
export default function MyApp({ Component, pageProps }) {
return (
<main className={GeistSans.className}>
<Component {...pageProps} />
</main>
)
}`
did you add transpilePackages: ["geist"] to next.config.js? what does your config file look like now?
@joulev did you add transpilePackages: ["geist"] to next.config.js? what does your config file look like now?
Sporting Lucas TerrierOP
thanks it worked
🙃