vuejs / vitepress

Vite & Vue powered static site generator.
https://vitepress.dev
MIT License
12.78k stars 2.07k forks source link

Assets of type webp (image) are not copied by build #4245

Open hschaefer123 opened 5 days ago

hschaefer123 commented 5 days ago

Describe the bug

Tried to use webp images inside src folder. It seems, that only jpg, png and gif are currently supported!

Reproduction

Just use any kind of image.webp referenced from markdown

Expected behavior

During build, referenced webp image should by copied to site asset folder the same way like png, etc.

System Info

System:
    OS: macOS 15.0
    CPU: (12) arm64 Apple M2 Max
    Memory: 1.93 GB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.16.0 - /opt/homebrew/opt/node@20/bin/node
    Yarn: 1.22.21 - /opt/homebrew/bin/yarn
    npm: 10.8.1 - /opt/homebrew/opt/node@20/bin/npm
    pnpm: 8.6.12 - /opt/homebrew/bin/pnpm
  Browsers:
    Chrome: 129.0.6668.71
    Safari: 18.0
  npmPackages:
    vitepress: ^1.3.4 => 1.3.4

Additional context

No response

Validations

brc-dd commented 5 days ago

It's working fine for me. Please share a minimal reproducible example.

image

If you're referencing that image from frontmatter then you need to keep it in public directory.

hschaefer123 commented 5 days ago

Hi Divyansh,

sorry, but you are right.

I am refering the image from vue instead md in this case i missunderstood, that only md referenced images will be copied.

I will switch over using /public folder in such cases.

Sorry for that!

Best regards Holger

brc-dd commented 5 days ago

For vue too it should work fine without moving files to public unless you're using dynamic source.

image