-
Notifications
You must be signed in to change notification settings - Fork 29.9k
Closed
Labels
invalid linkThe issue was auto-closed due to a missing/invalid reproduction link. A new issue should be opened.The issue was auto-closed due to a missing/invalid reproduction link. A new issue should be opened.locked
Description
The logic to allow specifying custom font-family of a local font implemented in #76274 is for Webpack only, and not ported to Turbopack.
Webpack
font-family: variableName is only inserted when there's no custom font family set:
next.js/packages/font/src/local/loader.ts
Line 67 in db55283
| ...(hasCustomFontFamily ? [] : [['font-family', variableName]]), |
Turbopack
scoped_font_family is always inserted:
next.js/crates/next-core/src/next_font/local/stylesheet.rs
Lines 67 to 82 in db55283
| @font-face {{ | |
| {} | |
| font-family: '{}'; | |
| src: url('@vercel/turbopack-next/internal/font/local/font?{}') format('{}'); | |
| font-display: {}; | |
| {}{} | |
| }} | |
| "#, | |
| options.declarations.as_ref().map_or_else( | |
| || "".to_owned(), | |
| |declarations| declarations | |
| .iter() | |
| .map(|declaration| format!("{}: {};", declaration.prop, declaration.value)) | |
| .join("\n") | |
| ), | |
| scoped_font_family, |
Reproduction
import localFont from 'next/font/local'
const geist = localFont({
src: './geist.woff2',
declarations: [
{
prop: 'font-family',
value: "Geist",
},
],
})With Turbopack, the above code results in a @font-face with two font-family properties:

Metadata
Metadata
Assignees
Labels
invalid linkThe issue was auto-closed due to a missing/invalid reproduction link. A new issue should be opened.The issue was auto-closed due to a missing/invalid reproduction link. A new issue should be opened.locked