nuxt / nuxt/image

Format has no effect on Content-Type in SSG/static mode

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

Nobody has claimed this yet.

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

Description

Hi,

is it normal that the defined format of images in generated mode (SSG) has no effect on the header content-type?

In dev mode, the content-type is changed as desired to e.g. webp, with <NuxtImg format="webp" src="..." />. In generated mode, the information can be found in the file path /_ipx/f_webp&..., but the content-type corresponds to the original image (jpg). I have already tried to set default values in the nuxt.config, but have had no success.

Is this an error in our setup or a bug in NuxtImg, or is this function simply only provided in dev/build mode?

  • NuxtImg: 1.10.0
  • Node Version: v20.14.0
  • Nuxt Version: 3.17.6
  • CLI Version: 3.25.1
  • Nitro Version: 2.11.13
  • Package Manager: pnpm@10.12.4

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

Start from the NuxtImg format="webp" entry point and reproduce the difference between dev mode and generated SSG output. Inspect the generated /_ipx/f_webp&... response and its Content-Type header; done means the header matches the transformed image format rather than the original JPEG.

Written by the indexing model from the issue text.

Assessment

Tech stack
nodejs, nuxtjs, typescript
Domain
web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.