Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot serve .webp image in mdx #4

Open
namdien177 opened this issue Aug 17, 2024 · 2 comments
Open

Cannot serve .webp image in mdx #4

namdien177 opened this issue Aug 17, 2024 · 2 comments

Comments

@namdien177
Copy link

namdien177 commented Aug 17, 2024

I'm using hybrid mode with mdx to render the blog content.

With @astrojs/node, the production build serves the image with .webp normally.
But with astro-bun, it is always 404 not found for images in webp format.

I checked with the png version of the same image, it serves normally.
I also ensured the webp version of the image was not broken.

[//]: # Sample mdx file in the content folder
import { Image } from 'astro:assets';

import ImageCAT6Cable from './cat6-cable.png';

some markdown content here

<figure>
  <Image
    loading={'lazy'}
    src={ImageCAT6Cable}
    alt="cat6 cable" />
  <figcaption>some caption</figcaption>
</figure>

some markdown content here

The image resolved to the correct path (/_astro/cat6-cable<random>.webp) but returns 404.
If I change the image path directly to the PNG version (/_astro/cat6-cable<random>.png), it will work just fine.

@namdien177
Copy link
Author

In the dev environment, it works fine.

But once I build the project and run the entry server with bun /dist/server/entry.mjs, the webp images won't be able to be served as described in the ticket.

@andrioid
Copy link

andrioid commented Sep 29, 2024

Same result here with plain .astro files and an imported png that is converted to webp. Attempts to load it here:

404 http://localhost:4321/_astro/coffee-art.DJfGxfQ-_Z8gfae.webp

dev works fine here too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants