Deployment Issue. All images are 404

So i made this website to practice filtering. On uploading the website to vercel/netlify all of my images (which are background-images) are all 404. Weird commit are me trying to debug (very badly ig) Link: https://entertainment-fawn.vercel.app/ Repo: https://github.com/Vasco-Mascarenhas/Entertainment
GitHub
GitHub - Vasco-Mascarenhas/Entertainment
Contribute to Vasco-Mascarenhas/Entertainment development by creating an account on GitHub.
32 Replies
Mannix
Mannixβ€’2y ago
probably path issue try changing imgs/thumbnails/undiscovered-cities/trending/small.jpg to ./imgs/thumbnails/undiscovered-cities/trending/small.jpg in data.json do that for all images
Azyrum
AzyrumOPβ€’2y ago
Changed, still the same Screenshot: The path it's pulling the images from on vercel
Azyrum
AzyrumOPβ€’2y ago
still need help with this 😦
b1mind
b1mindβ€’2y ago
Mannix those are both the same really xD
ErickO
ErickOβ€’2y ago
why is the image in an in-line style
b1mind
b1mindβ€’2y ago
looks like they are building it all with client JS .. which πŸ€·β€β™‚οΈ I'd try just writing the CSS and give the class
Azyrum
AzyrumOPβ€’2y ago
I'm mapping over the data array and using inline css to give the card a background-image
ErickO
ErickOβ€’2y ago
pain
b1mind
b1mindβ€’2y ago
try a direct path /imgs/ it should work cause you are in the root. I will say though not importing images with Vite it will not build with cache headers.
ErickO
ErickOβ€’2y ago
are you using a framework? some frameworks require you to put your images in some /dist or /public path
b1mind
b1mindβ€’2y ago
na its just flat index.html they load up
Azyrum
AzyrumOPβ€’2y ago
Using vanilla vite
b1mind
b1mindβ€’2y ago
So I assume you are not even using Vite build step?
Azyrum
AzyrumOPβ€’2y ago
I am
b1mind
b1mindβ€’2y ago
πŸ€” try the direct path and see
Azyrum
AzyrumOPβ€’2y ago
While building, it ignores the imgs folder
b1mind
b1mindβ€’2y ago
remove the . Right cause like Eric said vite looks for public folder for static assets I think by default I don't use vanilla vite so xD
ErickO
ErickOβ€’2y ago
Azyrum
AzyrumOPβ€’2y ago
I've only used vite with react so yeah
ErickO
ErickOβ€’2y ago
so the images just aren't there
Azyrum
AzyrumOPβ€’2y ago
had no idea it had this prob correct
b1mind
b1mindβ€’2y ago
Yea cause you are not shipping them if its not in the build
ErickO
ErickOβ€’2y ago
yup
b1mind
b1mindβ€’2y ago
https://vitejs.dev/guide/assets.html#the-public-directory Docs are your friend in this case always
ErickO
ErickOβ€’2y ago
Another instance of Erick being right 5Head next time folks
b1mind
b1mindβ€’2y ago
so you would move your /imgs/ to public/imgs/ and use a absolute path like I was saying /imgs/
Azyrum
AzyrumOPβ€’2y ago
worked Was a dummy and didn't read the docs thanks everyone ❀️
ErickO
ErickOβ€’2y ago
πŸ‘
b1mind
b1mindβ€’2y ago
np also next time don't double ask though (ask in general to help with your post*), it is in the #πŸ“rules >.>;; bad habit to get into just figured I'd warn ya
Azyrum
AzyrumOPβ€’2y ago
Yes boss, will do
Want results from more Discord servers?
Add your server