nuxt / nuxt/image

Alias not working with IPX

Open
#1,065 9 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Alias is not working with default provider IPX

Reproduction:
https://stackblitz.com/edit/github-kmj5sa?file=nuxt.config.ts

I did a npm run generate i.e. nuxi generate.
The image generated still contains the domain.

Below is the settings:

  image: {
    domains: ['images.pexels.com'],
    alias: {
      backend: 'https://images.pexels.com',
    },
  },

and image generated

https://githubkmj5sa-smd0--3000--1f9496ab.local-credentialless.webcontainer.io/_ipx/f_webp/https://images.pexels.com/photos/38292/walnut-nut-fruit-bowl-healthy-38292.jpeg

I thought maybe alias just doesn't work with IPX but in the IPX provider code I see
https://github.com/nuxt/image/blob/58c5139106ed1552a98d318b5ca281e298c36180/src/runtime/providers/ipx.ts#L38
which makes me think IPX does support alias.

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 with the StackBlitz reproduction and nuxt.config.ts, run npm run generate (nuxi generate), then inspect src/runtime/providers/ipx.ts at the linked provider logic. Confirm how the alias setting is handled for IPX and ensure the generated image URL uses the configured alias rather than the original domain.

Written by the indexing model from the issue text.

Assessment

Tech stack
nuxt, 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.