vercel / next.js

The React Framework
https://nextjs.org
MIT License
122.59k stars 26.23k forks source link

next/font does not preload fonts that are used in dynamic imports #67174

Open BilalJaved15 opened 4 days ago

BilalJaved15 commented 4 days ago

Link to the code that reproduces this issue

https://github.com/BilalJaved15/next-font-dynamic

To Reproduce

  1. Start the application (npm run dev).
  2. The component 'A' is rendered on server side but Nunito Sans (next/font) used in it is not preloaded.

Current vs. Expected behavior

Currently, the font Nunito Sans is not preloaded even though it is rendered on server side, I expected it to be preloaded.

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.5.0: Wed May  1 20:12:58 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6000
Binaries:
  Node: 20.9.0
  npm: 10.1.0
  Yarn: 1.22.21
  pnpm: N/A
Relevant Packages:
  next: 14.1.1-canary.37 // There is a newer canary version (15.0.0-canary.43) available, please upgrade! 
  eslint-config-next: 14.2.4
  react: 18.3.1
  react-dom: 18.3.1
  typescript: 5.5.2
Next.js Config:
  output: N/A

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

Font (next/font)

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

next dev (local), next start (local), Other (Deployed)

Additional context

No response