Nextjs14 app router import local image from public folder not working
Answered
Crazy ant posted this in #help-forum
Crazy antOP
Hello, I am unable to import local images from public folder. My import looks as below
But import fails when I build the app. Please help.
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
4 Replies
@Crazy ant 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.
https://nextjs-faq.com/module-not-found-due-to-case-sensitivity most likely it's due to wrong capitalisation
Answer
Crazy antOP
So do I need to change image file name as avatar.png
@Crazy ant So do I need to change image file name as avatar.png
it could be aVatar.png, it could be you named your folder Public. you need to check your file names on github
Crazy antOP
@joulev , Thanks. It works.