image icon indicating copy to clipboard operation
image copied to clipboard

Image is in _ipx folder and can't be found

Open JosefHjorth opened this issue 3 years ago • 13 comments

When building my solution it tries to reference the images in a missing _ipx folder.

<source type="image/webp" 
srcset="/_ipx/images/stock_collage.png?w=320&amp;f=webp 320w, 
/_ipx/images/stock_collage.png?w=640&amp;f=webp 640w, 
/_ipx/images/stock_collage.png?w=768&amp;f=webp 768w, 
/_ipx/images/stock_collage.png?w=700&amp;f=webp 700w, 
/_ipx/images/stock_collage.png?w=700&amp;f=webp 700w" 
sizes="(max-width: 320px) 100vw, (max-width: 640px) 100vw, (max-width: 768px) 100vw, (max-width: 1024px) 700px, 700px">

This is my (relevant) configuration. I've tried with the default configuration, but whatever I do nuxt-image tries to reference _ipx folder.

export default {
  ssr: false,
  target: "static",
  buildModules: [
    '@nuxt/image',
  ],
  image: {
    staticFilename: '[publicPath]/images/[name]-[hash][ext]'
  },
}

This is the html element: <nuxt-picture format="webp" sizes="xl:700 lg:700 md:100vw sm:100vw xs:100vw" src="/images/stock_collage.png" />

Why is nuxt-image referencing non existent _ipx folder?

JosefHjorth avatar Jul 05 '21 09:07 JosefHjorth

I noticed there was a similar issue reported here; https://github.com/nuxt/image/issues/215 , but I'm running 0.5.0 already

Also, people seem to get a "Generated static image" when running npm (or yarn) run generate in the console output, but I don't get that.

JosefHjorth avatar Jul 05 '21 15:07 JosefHjorth

Is the issue with ssr: false,? I believe the _ipx route is a server side endpoint that does the image manipulation. Without the server running the static image provider (ipx) can't be accesses to generate the static images?

shadow81627 avatar Jul 05 '21 23:07 shadow81627

Thanks! Might be, but does that mean I can't use nuxt/image since I use client side rendering only?

JosefHjorth avatar Jul 06 '21 06:07 JosefHjorth

I believe the @nuxt/image static provider (ipx) requires full static setup.

You may need to consider another @nuxt/image provider such as cloudinary to host the images and do image transformations.

shadow81627 avatar Jul 06 '21 06:07 shadow81627

Switched to cloudinary and it worked much better. Thanks.

JosefHjorth avatar Jul 07 '21 06:07 JosefHjorth

@shadow81627 cant the IPX part be run during the generation step? like, open the server for IPX; generate the images, close it down, and then we are left with the images plus a client-only / full static generated site?

ChristopherCapito avatar Jul 22 '21 22:07 ChristopherCapito

Yes, I run ipx with static target. You might need to have SSR on for the ipx server to run during generate.

shadow81627 avatar Jul 22 '21 22:07 shadow81627

So it seems that having

target: 'static'
ssr: false

breaks nuxt-image with the default provider. This also happens in 0.5.0.

Any solution besides using another provider as suggested above? I'd just like to run the ipx optimizations on generate command and have all ready in the dist folder to be moved to production :)

salv0 avatar Aug 30 '21 16:08 salv0

Any updates here?

elglogins avatar Dec 26 '22 15:12 elglogins

+1

WieFel avatar Oct 31 '23 22:10 WieFel

any update?

dinkar030501 avatar Feb 16 '24 16:02 dinkar030501

Any update? I'm running a Nuxt3 App with ssr false.

oxedom avatar Jul 17 '24 18:07 oxedom