Skip to content

turbopack build does not correctly resolve fonts from next/fonts #77861

@stefanprobst

Description

@stefanprobst

Link to the code that reproduces this issue

https://github.com/stefanprobst/issue-next-turbo-fonts

To Reproduce

  1. clone repo, pnpm install
  2. pnpm build (which runs next build --turbopack) and pnpm start (which runs next start --turbopack)
  3. open http://localhost:3000 and inspect the <h1> which does not have "Geist" font family applied
  4. for comparison, inspect the h1 after running either pnpm dev (which runs next dev --turbopack) or run pnpm build:webpack && pnpm start:webpack - in all these cases the h1 has the correct "Geist" font-family applied.
  5. NOTE: when next/font is not imported in the not-found page here it does work correctly with turbopack build as well.

Current vs. Expected behavior

turbopack build should behave like webpack build/dev, and turbopack dev.

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #202403151937 SMP PREEMPT_DYNAMIC Fri Mar 15 19:52:22 UTC 2024
  Available memory (MB): 31401
  Available CPU cores: 16
Binaries:
  Node: 22.14.0
  npm: 10.9.2
  Yarn: 1.22.22
  pnpm: 10.6.2
Relevant Packages:
  next: 15.3.0-canary.38 // Latest available version is detected (15.3.0-canary.38).
  eslint-config-next: N/A
  react: 19.1.0
  react-dom: 19.1.0
  typescript: 5.8.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Turbopack, Font (next/font)

Which stage(s) are affected? (Select all that apply)

next build (local)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Font (next/font)Related to Next.js Font Optimization.TurbopackRelated to Turbopack with Next.js.linear: turbopackConfirmed issue that is tracked by the Turbopack team.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions