Generate is missing a slash '/' when prerendering using ipx
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
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]
I'm also having this issue
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!
Still an issue in v2.0.0. I've just opened this before unstading: https://github.com/nuxt/image/issues/2029#issuecomment-3539469802
@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
actually the line in that commit fixes this issue afaict
Thanks @danielroe :-)