"public/humansans/HumanSans-Regular.woff2" not being seen my nextjs
Unanswered
Grand Griffon Vendéen posted this in #help-forum
Grand Griffon VendéenOP
nextjs is unable to see a font file located in public, but if I put that file inside the app folder, it works.
My code:
Server Error
Error: Expected font file content
Debug info:
- Execution of get_written_endpoint_with_issues failed
- Execution of Issue::into_plain failed
- Execution of <ResolvingIssue as Issue>::detail failed
- Execution of <NextFontLocalReplacer as ImportMappingReplacement>::result failed
- Execution of get_font_css_properties failed
- Execution of get_font_fallbacks failed
- Expected font file content
My code:
const human_sans = localFont({
variable: '--human',
display: 'auto',
src: '/humansans/HumanSans-Regular.woff2',
})
5 Replies
try
const human_sans = localFont({
variable: '--human',
display: 'auto',
src: './public/humansans/HumanSans-Regular.woff2',
})
Grand Griffon VendéenOP
already did, doesn't work
ok try
const human_sans = localFont({
variable: '--human',
display: 'auto',
src: '../../public/humansans/HumanSans-Regular.woff2',
})
Grand Griffon VendéenOP
it worked thank you :D
I still would love to know why nextjs sees other folders in public without doing ../../ tho
I still would love to know why nextjs sees other folders in public without doing ../../ tho
look like the
src
expect a relative path and it will load the font from where localFont
is defined