import Image from 'next/image';
nextjs在使用上述import時,<Image />的src預設位於root/public
因此image的src路徑如下:
<Image src="/assets/icon.svg" width="45" height="45" alt=" "/>
範例的文件結構
[root]
\public
\assets
icon.svg
切記不要加點變成./assets/...
,這樣路徑會是相對路徑因而找不到圖片。