Nextjs image location

323 Views Asked by At

I am new to nextjs and trying to export my application as HTML after I run npm run export

When I use the <img /> tag some images do not get displayed on the webpage.

The question is, can anyone advise me on if I should load my images from the public folder or the asset folder because currently, I am loading from both folders.

1

There are 1 best solutions below

0
On

Next.js serves images and other static files, under the public folder in the root directory. Files inside the public folder can then be referenced by your code starting from the base URL (/). This is further explained here

You don't need to load from an asset folder, create/store your images to your public folder and link them to the Image tag