Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/content/docs/en/recipes/dynamically-importing-images.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ In this recipe, you will learn how to dynamically import your images using Vite'
}

const { imagePath, altText, name, age } = Astro.props;
const images = import.meta.glob<{ default: ImageMetadata }>('/src/assets/*.{jpeg,jpg,png,gif}')
const images = import.meta.glob<{ default: ImageMetadata }>('/src/assets/*.{jpeg,jpg,png,gif,JPEG,JPG,PNG,GIF}')
---
```

Expand All @@ -88,7 +88,7 @@ In this recipe, you will learn how to dynamically import your images using Vite'
}

const { imagePath, altText, name, age } = Astro.props;
const images = import.meta.glob<{ default: ImageMetadata }>('/src/assets/*.{jpeg,jpg,png,gif}');
const images = import.meta.glob<{ default: ImageMetadata }>('/src/assets/*.{jpeg,jpg,png,gif,JPEG,JPG,PNG,GIF}');
---
<div class="card">
<h2>{name}</h2>
Expand All @@ -115,8 +115,8 @@ In this recipe, you will learn how to dynamically import your images using Vite'
}

const { imagePath, altText, name, age } = Astro.props;
const images = import.meta.glob<{ default: ImageMetadata }>('/src/assets/*.{jpeg,jpg,png,gif}');
if (!images[imagePath]) throw new Error(`"${imagePath}" does not exist in glob: "src/assets/*.{jpeg,jpg,png,gif}"`);
const images = import.meta.glob<{ default: ImageMetadata }>('/src/assets/*.{jpeg,jpg,png,gif,JPEG,JPG,PNG,GIF}');
if (!images[imagePath]) throw new Error(`"${imagePath}" does not exist in glob: "src/assets/*.{jpeg,jpg,png,gif,JPEG,JPG,PNG,GIF}"`);
---
<div class="card">
<h2>{name}</h2>
Expand Down
Loading