Skip to content

Commit e27dec8

Browse files
author
csFan
committed
fix: use BASE_URL for art image paths on mobile/pages
1 parent 1754faf commit e27dec8

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/App.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { blogPosts, bootLines, contactConfig, digitalIdentity, educationList, pe
1111
useEcharts([RadarChart, RadarComponent, TooltipComponent, LegendComponent, CanvasRenderer]);
1212

1313
const SLIDE_TRANSITION_MS = 820;
14+
const PUBLIC_BASE_URL = (import.meta.env.BASE_URL || "/").replace(/\/?$/, "/");
1415

1516
const artPhotoModules = import.meta.glob("../public/art/**/*.webp");
1617

@@ -19,7 +20,7 @@ const artPhotoCategoryMap = Object.keys(artPhotoModules).reduce((accumulator, pa
1920
if (!matched) return accumulator;
2021
const category = decodeURIComponent(matched[1]);
2122
if (!accumulator[category]) accumulator[category] = [];
22-
accumulator[category].push(path.replace("../public", ""));
23+
accumulator[category].push(`${PUBLIC_BASE_URL}${path.replace("../public/", "")}`);
2324
return accumulator;
2425
}, {});
2526

0 commit comments

Comments
 (0)