Giter Site home page Giter Site logo

Comments (22)

spidgorny avatar spidgorny commented on June 12, 2024 47

This is a fix that worked for me (next.config.js):

transpilePackages: ["geist"],

from geist-font.

aryanprince avatar aryanprince commented on June 12, 2024 23

Apparently this error only shows up on pages router. Can someone vouch for this?

I built two new Nextjs 14 apps (app and pages), installed Geist font, and added GeistSans.classNames to _app.tsx and layout.tsx respectively. App router version works fine, pages router one shows the same 'Cannot use import statement outside a module' error.

Link to repos I tested this with: Pages Router (error) & App Router (all good).

Feel free to StackBlitz these since I couldn't get that to work.

from geist-font.

VapidLinus avatar VapidLinus commented on June 12, 2024 16

@darnfish I don't think this issue should be closed.

It's great we found a workaround, but this is still an issue imo until they add this to the installation instructions on the website or the npm page.

from geist-font.

washedlih avatar washedlih commented on June 12, 2024 9

have this issue as well

from geist-font.

AnimeAllstar avatar AnimeAllstar commented on June 12, 2024 9

Me too. Looks like they didn't bother testing it with the pages router.

from geist-font.

iamdevmarcos avatar iamdevmarcos commented on June 12, 2024 7

the same issue here

from geist-font.

dieharders avatar dieharders commented on June 12, 2024 4

Same issue. Using "pages" router.

When using import { GeistSans, GeistMono } from 'geist/font' I get the SyntaxError same as OP.
However, when using import localFont from "next/font/local" and then manually downloading fonts into my project is the only way I can load this font without getting the error.

Next.js: v14.0.1
React: v18.2.0
Using PNPM package manager.

from geist-font.

benjypng avatar benjypng commented on June 12, 2024 4

@darnfish I don't think this issue should be closed.

It's great we found a workaround, but this is still an issue imo until they add this to the installation instructions on the website or the npm page.

I think so too. It seems like the source of the issue has not been discovered yet.

from geist-font.

ckrook avatar ckrook commented on June 12, 2024 3

Hello, me to!

from geist-font.

stijnelskens avatar stijnelskens commented on June 12, 2024 3

Bump, also having this issue

from geist-font.

heyarviind avatar heyarviind commented on June 12, 2024 3

getting same issue

from geist-font.

kiltedDev avatar kiltedDev commented on June 12, 2024 3

This is a fix that worked for me (next.config.js):

transpilePackages: ["geist"],

This fixed it for me as well.

"next": "^13.5.4",
"react": "18.2.0",

using Bun as package manager for this one.

from geist-font.

ethndotsh avatar ethndotsh commented on June 12, 2024 2

me as well

from geist-font.

aryanprince avatar aryanprince commented on June 12, 2024 2

I made a new issue (#59) with more information about this issue, check it out. Hopefully it gets resolved.

@VapidLinus @hkgnp

from geist-font.

jacobdalamb avatar jacobdalamb commented on June 12, 2024 1

Also couldn't get Geist package to work in Astro

from geist-font.

JohnPhamous avatar JohnPhamous commented on June 12, 2024

@darnfish can you provide a Codesandbox/Replit/repo that repros the problem?

from geist-font.

eriksik2 avatar eriksik2 commented on June 12, 2024

Also getting this error on nextjs v13.5.4 with pages router.

from geist-font.

carloscdante avatar carloscdante commented on June 12, 2024

Also getting this error on Next 13.4.16 w/pages router

from geist-font.

JonHMChan avatar JonHMChan commented on June 12, 2024

Also getting this error with pages

from geist-font.

benjypng avatar benjypng commented on June 12, 2024

Having this issue with pages router as well.

from geist-font.

enricoros avatar enricoros commented on June 12, 2024

Same - pages router, NextJS 13.4.19 (not updating to13.5/14 because of larger bundle sizes)

from geist-font.

darnfish avatar darnfish commented on June 12, 2024

This is a fix that worked for me (next.config.js):

transpilePackages: ["geist"],

Thanks @spidgorny! This worked for me. I had to also add font-sans to my root Tailwind component for the font to actually render, Geist docs makes this kind of difficult to figure out.

from geist-font.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.