Comments (22)
This is a fix that worked for me (next.config.js
):
transpilePackages: ["geist"],
from geist-font.
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.
@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.
have this issue as well
from geist-font.
Me too. Looks like they didn't bother testing it with the pages router.
from geist-font.
the same issue here
from geist-font.
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.
@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.
Hello, me to!
from geist-font.
Bump, also having this issue
from geist-font.
getting same issue
from geist-font.
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.
me as well
from geist-font.
I made a new issue (#59) with more information about this issue, check it out. Hopefully it gets resolved.
@VapidLinus @hkgnp
from geist-font.
Also couldn't get Geist package to work in Astro
from geist-font.
@darnfish can you provide a Codesandbox/Replit/repo that repros the problem?
from geist-font.
Also getting this error on nextjs v13.5.4 with pages router.
from geist-font.
Also getting this error on Next 13.4.16 w/pages router
from geist-font.
Also getting this error with pages
from geist-font.
Having this issue with pages router as well.
from geist-font.
Same - pages router, NextJS 13.4.19 (not updating to13.5/14 because of larger bundle sizes)
from geist-font.
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)
- Suggestions for improving the Cyrillic shapes HOT 2
- Yay package broken
- Can't download from release page HOT 1
- 400 and 300 font-weight issues with Variable file for Geist Sans HOT 3
- Font is unsupported for Vercel og-image generation
- [Next] Allow importing font files directly
- Need help installing font in react app and tailwind css HOT 1
- windows terminal warns geist mono is not monospaced
- [Website] Toggle font family in website is slow HOT 1
- `TypeError: next_font_local__WEBPACK_IMPORTED_MODULE_0___default(...) is not a function` when used "use client" HOT 1
- Onboarding Geist to Google Fonts HOT 4
- Download link doesn't work in the readme
- Lowercase letter `L` looks too similar to number `1` HOT 4
- GeistMono rendering weird ligature when using `!==`
- Font Weight with Geist Sans on Mac OS
- RollupError when using Geist with Remix (Vite)
- Outline Rendering Issues in CSS
- Add support for Philippine Peso (₱)
- Text Stroke Rendering Issue HOT 3
- Invalid link to the license in the readme.md
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from geist-font.