Recently, I decided to explore the app
directory and unfortunately ran into some issues.
One of the main problems I encountered was with image imports.
While PNG images imported without any problem, SVG images seemed to break when importing in /app
.
For instance, there was a specific URL that worked perfectly fine in /pages
but failed in /app
:
import Logo from 'public/company.svg';
When checking the imported image object (from within the component), it appeared like this in the console:
{
src: '/_next/static/media/company.99a082b8.svg',
height: 32,
width: 162
}
Interestingly, the actual file was missing in the /media
folder.
I am now wondering how I can effectively import SVG images into my NextJS 13+ project?
Update:
To resolve the issue, I have incorporated SVGR for importing SVGs as components, which has resolved functionality; however, the build issue still remains unresolved.