nuxt / nuxt/image

Nuxt Picture with format fallback does not render the avif format but webp

Open
#1,630 4 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug help wanted
Dominant language
TypeScript
Stars
1.5k
Forks
331
Avg merge
19h 52m
Merged PRs (30d)
9

Description

I'm using NuxtPicture with format="avif,webp" and ipx. When I test the page in npm run dev, the image type in Network tab is correct: image/avif. However, when I run npm run generate and serve the build, the images in Network tab have the content type image/webp which is the original content type of my source image.

I see the image is served from a correct avif folder:
GET /_ipx/w_400&f_avif/images/blog/1-front-panels-tips/01-front-matter.webp

I tried putting this in my nuxt config:

image: {
    provider  : "ipx",  // the default
    format    : ['avif', 'webp'],
    ipx       : {
      modifiers : {
        format  : 'avif'
      }
    }
  },

but the content type after generate is still image/webp.

I'm using @nuxt/image@1.8.0

Originally posted by @arxwtf in https://github.com/nuxt/image/issues/1345#issuecomment-2351591708

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with @nuxt/image@1.8.0 using npm run dev and npm run generate, then inspect the generated _ipx/w_400&f_avif/... response in the Network tab. Compare the response content type and generated output between development and the served build; done means the requested avif fallback is served with the correct image content type after generation.

Written by the indexing model from the issue text.

Assessment

Tech stack
nuxt, typescript
Domain
frontend, performance
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.