reactjsgithubdeploymentgithub-pagesvite

Vite (react) project after building, dist folder/assets don't have any image


I create a react project by using vite. When i run command npm run build to build my project then dist folder is create but my images are neither showing in dist/assets nor in deploy page on github.my folder structure image

my terminal image

My previous projects build without any problen dist/assets/ folder.I have already added base in vite.config.js.

I think that my images are not including when i build my project.I want to build my project with images.Sorry, for bad english.


Solution

  • I were putting image source like this src/images/image.png thats was reason why build command not adding image to dist folder. Correct way to give image source like this : ./images/image.png.

    You can also give image src by import images.

    import image from "./images/image.png"