404 error not found on images in relative path when deploying to surge

27 Views Asked by At

I am trying to deploy a vite react app to surge. It does not load my images from my images folder and I get a 404 not found error in the console for the images.

I have tried changing the domain name and double checked the paths. The images folder is in my public folder. All other images from an API i am using are fine. Anyone else had this issue or can help?

1

There are 1 best solutions below

1
Anuj Ghom On

I faced this error when i deployed on Netlify.

Try importing images instead of giving path

import image_name from "path-to-image"

or if you have so many images use Cloudinary to upload images and use url