diff --git a/src/components/misc/ImageBox.astro b/src/components/misc/ImageBox.astro index d0aee2a..0e06739 100644 --- a/src/components/misc/ImageBox.astro +++ b/src/components/misc/ImageBox.astro @@ -1,4 +1,5 @@ --- +import path from "path"; interface Props { id?: string src: string; @@ -12,9 +13,12 @@ const className = Astro.props.class; const isLocal = !(src.startsWith('/') || src.startsWith('http') || src.startsWith('https') || src.startsWith('data:')); +// TODO temporary workaround for images dynamic import let img; if (isLocal) { - img = (await import("../../" + src)).default; + const files = import.meta.glob("../../**", { import: 'default' }); + let normalizedPath = "../../" + path.normalize(src).replace(/\\/g, "/"); + img = await (files[normalizedPath])(); } --- @@ -22,6 +26,5 @@ if (isLocal) {
{isLocal && {alt} {!isLocal && {alt} -