Next.js Discord

Discord Forum

Nextjs14 app router import local image from public folder not working

Answered
Crazy ant posted this in #help-forum
Open in Discord
Avatar
Crazy antOP
Hello, I am unable to import local images from public folder. My import looks as below
import Avatar from "../../public/images/Avatar.png" , it works in local.
But import fails when I build the app. Please help.
Answered by joulev
https://nextjs-faq.com/module-not-found-due-to-case-sensitivity most likely it's due to wrong capitalisation
View full answer

4 Replies

Avatar
joulev
https://nextjs-faq.com/module-not-found-due-to-case-sensitivity most likely it's due to wrong capitalisation
Answer
Avatar
Crazy antOP
So do I need to change image file name as avatar.png
Avatar
joulev
it could be aVatar.png, it could be you named your folder Public. you need to check your file names on github
Avatar
Crazy antOP
@joulev , Thanks. It works.