From 36670fd52841eedd61465eeda6803eff0ea913c1 Mon Sep 17 00:00:00 2001 From: dereklseitz Date: Sun, 28 Sep 2025 14:11:55 -0500 Subject: [PATCH] fix: resolve header image paths in production build - Add import.meta.glob to process header images in PostCard component - Replace manual URL construction with Vite's asset handling - Ensures images load correctly in both dev and production environments --- src/components/Cards/PostCard.jsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/Cards/PostCard.jsx b/src/components/Cards/PostCard.jsx index bc499a8..145b29f 100644 --- a/src/components/Cards/PostCard.jsx +++ b/src/components/Cards/PostCard.jsx @@ -3,10 +3,12 @@ import React from 'react'; import { Button } from '@progress/kendo-react-buttons'; import { Card, CardImage, CardBody } from '@progress/kendo-react-layout'; +// Import all header images so Vite processes them +const headerImages = import.meta.glob('../../assets/header/*', { eager: true }); + const PostCard = ({ post, onEdit }) => { const dataPath = post.header.image; - const relativePath = `../../${dataPath}`; - const imageUrl = new URL(relativePath, import.meta.url).href; + const imageUrl = headerImages[`../../${dataPath}`]?.default || dataPath; const formatDate = (utcString) => { if (!utcString) return '';