#images not loading

4 messages · Page 1 of 1 (latest)

tough halo
#

Images are not loading on my dev server from mdx files. It shows a placeholder instead

hollow baneBOT
#

Hi @tough halo. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Based on the information provided in the extracts, there could be several reasons why images are not loading from your .mdx files in Astro.

  1. Incorrect Image Path: Ensure that the path to your image is correct. In Astro, images in .mdx files are relative to the current file. To refer to an image that is located in the same folder as the .mdx file, the path should start with ./. If the image is not found, Astro will throw an error like "Could not find requested image IMAGE_PATH at FULL_IMAGE_PATH." [^1^]

  2. Known Bugs: There are known bugs in Astro related to image loading from .mdx files. For instance, there's a bug where the img MDX component override is not used in Astro collections[^3^]. Another bug is related to the Astro:assets remote image with Vercel ImageService not using astro domains and remote patterns[^4^]. There's also a bug where "fetch failed" for <Image> component when transforming local images[^5^]. If you're experiencing any of these issues, you might want to follow the respective GitHub issues for updates or potential workarounds.

  3. Alt Text Missing: There's a known bug where missing alt text results in an opaque error message[^7^]. Ensure that all your images have the alt attribute.

  4. Remark Plugins Ignored: If you're using Remark plugins, there's a known bug where Astro 3.0 Markdown/MDX auto image asset imports ignore Remark plugins[^8^].

If none of the above solutions work, you might want to create an issue on the Astro GitHub repository[^2^] or ask for help on their Discord[^2^].

#

^1^]: [Astro Documentation - Image not found (https://docs.astro.build/en/reference/errors/markdown-image-not-found/)
^2^]: [Astro Blog - Better Images in Astro (https://astro.build/blog/images/)
^3^]: [GitHub Issue - img MDX component override is not used in Astro collections (https://github.com/withastro/astro/issues/7223)
^4^]: [GitHub Issue - Astro:assets remote image with vercel ImageService does not use astro domains and remotepatterns (https://github.com/withastro/astro/issues/8173)
^5^]: [GitHub Issue - "fetch failed" for <Image> component when transforming local images (https://github.com/withastro/astro/issues/5699)
^7^]: [GitHub Issue - Missing alt text results in opaque error message (https://github.com/withastro/astro/issues/8248)
^8^]: [GitHub Issue - Astro 3.0 Markdown/MDX auto image asset imports ignore Remark plugins (https://github.com/withastro/astro/issues/8311)

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: