Next.js Discord

Discord Forum

Local font can not load in folder "Module not found: Can't resolve"

Unanswered
noli posted this in #help-forum
Open in Discord
const ParaboleDisplay = localFont({src: "../fonts/Parabole-DisplayRegular.otf"}) doesn't work in app/objekt/page.js and im getting "Module not found: Can't resolve './fonts/dotmat.ttf", but in the regular app/page.js, the same thing works and it works in components as well.

2 Replies

Ended up just duplicating the fonts folder outside of app into app
@noli `const ParaboleDisplay = localFont({src: "../fonts/Parabole-DisplayRegular.otf"})` doesn't work in app/objekt/page.js and im getting "Module not found: Can't resolve './fonts/dotmat.ttf", but in the regular app/page.js, the same thing works and it works in components as well.
Make sure the path to your dotmat.ttf file is correct. The ./ in ./fonts/dotmat.ttf means that it’s looking for the fonts directory in the same directory as the current file (app/objekt/page.js). If your fonts directory is located elsewhere, you’ll need to adjust the path accordingly.