vercel / geist-font

https://vercel.com/font
SIL Open Font License 1.1
2.13k stars 54 forks source link

Geist typeface does not seem to work with latest Next.js canary, required for PPR #76

Closed peibolsang closed 5 months ago

peibolsang commented 6 months ago

Font Name (Geist Sans/Geist Mono):

Description of the Issue: I deployed a version of my app using Next.js 14.0.4 and Geist 1.2.0and everything worked fine. I could deploy it on vercel.com without issues. However, I decided to enable Partial Pre-rendering (PPR) and got this error:

 Error: The experimental.ppr preview feature can only be enabled when using the latest canary version of Next.js. See more info here: https://nextjs.org/docs/messages/ppr-preview
    at assignDefaults (/vercel/path0/node_modules/next/dist/server/config.js:265:15)
    at loadConfig (/vercel/path0/node_modules/next/dist/server/config.js:760:32)
    at async Span.traceAsyncFn (/vercel/path0/node_modules/next/dist/trace/trace.js:147:20)

Of course, I updated to the latest canary (14.0.5-canary.36 at the time this issue was posted) and now I got this error:

ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: geist@1.2.0
npm ERR! Found: next@14.0.5-canary.36
npm ERR! node_modules/next
npm ERR!   next@"14.0.5-canary.36" from the root project
npm ERR!   peer next@"*" from next-themes@0.2.1
npm ERR!   node_modules/next-themes
npm ERR!     next-themes@"^0.2.1" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer next@"^13.2 || ^14" from geist@1.2.0
npm ERR! node_modules/geist
npm ERR!   geist@"^1.2.0" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: next@14.0.4
npm ERR! node_modules/next
npm ERR!   peer next@"^13.2 || ^14" from geist@1.2.0
npm ERR!   node_modules/geist
npm ERR!     geist@"^1.2.0" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! 

Steps to Reproduce:

  1. Use Vercel Geist typeface 1.2.0 with Next.js 14.0.4 and everything works fine. App is built in vercel.com without issues
  2. Update your app to Next.js 14.0.5-canary.36 (necessary for PPR)
  3. Build on Vercel.com and you'll get the error

Expected Behavior: Geist typeface should be working on 14.0.5-canary.36 (necessary for PPR) as it works in 14.0.4

Environment (please complete the following information):

mwskwong commented 5 months ago

This is mostly related to how the peer dependency is defined and can be worked around by using --legacy-peer-deps while running npm install and npm update.

Currently, the peer dependency in https://github.com/vercel/geist-font/blob/main/packages/next/package.json is defined as:

"peerDependencies": {
  "next": "^13.2 || ^14"
}

It can be changed to

"peerDependencies": {
  "next": ">=13.2.0 <15"
}

to accept next@canary versions.