Some of my images (not all) are copying to my dist folder my Vite+REACT site. #164430
Replies: 1 comment
-
You're running into this issue because your images you're attempting to reference are in the Try moving your images in your public directory instead of storing them in your src directory. Example:
Then you should be able to change your export default function Socials() {
const socialMedia = [
{
social: "tik-tok",
link: "https://www.tiktok.com/@malgus_games_dev",
imagePath: "/tik_tok.png",
},
{
social: "instagram",
link: "https://www.instagram.com/kramermalgusgames/",
imagePath: "/instagram.png",
},
{
social: "youtube",
link: "https://www.youtube.com/@malgusgames",
imagePath: "/youtube.png",
},
];
return (
<div className="socials">
{socialMedia.map((i) => (
<a className="social-link" href={i.link}>
<div className="social-image">
<img src={i.imagePath} alt={i.social} />
</div>
</a>
))}
</div>
);
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Select Topic Area
Question
Body
I'm new to using Pages and Vite in general, and I'm not sure what I'm missing. Some of the images for my site, my flavicon and background image, are showing, but the rest of my images aren't. I am getting a notice when I deploy that these items are being transformed and added to my dist/ file. But the others aren't and I'm assuming that's why they aren't appearing? Any help or even just getting pointed in the right direction would be greatly appreciated!
Beta Was this translation helpful? Give feedback.
All reactions