image icon indicating copy to clipboard operation
image copied to clipboard

Generate is missing a slash '/' when prerendering using ipx

Open TechAkayy opened this issue 2 years ago • 2 comments

npm run build works fine, but when doing npm run generate, the generated image path is missing a "/", so failing to be picked up.

Please refer to app.vue that is using the vuetify example from the official Nuxt Image docs - https://image.nuxt.com/usage/use-image. I guess the file path can't be double-slashed, so wondering how to mitigate this issue.

Reproduction - https://github.com/TechAkayy/nuxt-image-generate-issue.

Local: npm run generate, then npx serve .output/public

image
Dependencies Info

Run npx nuxi info and pnpm list (or npm list) and provide the output:

------------------------------
- Operating System: `Darwin`
- Node Version:     `v20.14.0`
- Nuxt Version:     `3.13.0`
- CLI Version:      `3.13.1`
- Nitro Version:    `2.9.7`
- Package Manager:  `[email protected]`
- Builder:          `-`
- User Config:      `compatibilityDate`, `devtools`, `modules`, `image`
- Runtime Modules:  `@nuxt/[email protected]`, `[email protected]`
- Build Modules:    `-`
------------------------------

nuxt-app@ /Users/techakayy/Templates/!reproductions/nuxt-image-generate-issue
├── @nuxt/[email protected]
├── [email protected]
├── [email protected]
└── [email protected]

TechAkayy avatar Oct 29 '23 09:10 TechAkayy

I'm also having this issue

sagenate24 avatar Nov 04 '23 00:11 sagenate24

Updated reproduction to latest image module v1.8.0 & made it minimal.

@danielroe, noticed you are back to image module updates, can you give this issue little love, have been a blocker for over 10 months for nuxt generate.

The reproduction is the vuetify useImage example from our official docs page, but nuxt generate instead of nuxt build.

Thanks!

TechAkayy avatar Aug 31 '24 04:08 TechAkayy

Still an issue in v2.0.0. I've just opened this before unstading: https://github.com/nuxt/image/issues/2029#issuecomment-3539469802

mrleblanc101 avatar Nov 16 '25 23:11 mrleblanc101

@danielroe Found the issue in this commit: https://github.com/nuxt/image/commit/30413714feb4163982a88d57e68e61fafb84b13e This line is wrong, it removes the double slash from https://.

https://github.com/nuxt/image/blob/aba9b7f88900340002d5a3f12bf7f9f50ca2a613/src/runtime/providers/ipxStatic.ts#L23

I'm not sure why this was needed, I think joinURL from ufo already remove the double slash in the URL if needed. Example, if you join domain.com/ and /some-path, it will output domain.com/some-path and not domain.com//some-path

mrleblanc101 avatar Nov 17 '25 00:11 mrleblanc101

actually the line in that commit fixes this issue afaict

danielroe avatar Nov 18 '25 09:11 danielroe

Thanks @danielroe :-)

TechAkayy avatar Nov 19 '25 21:11 TechAkayy