nuxt / image

Plug-and-play image optimization for Nuxt applications.
https://image.nuxt.com
MIT License
1.31k stars 267 forks source link

Image is in _ipx folder and can't be found #354

Open JosefHjorth opened 3 years ago

JosefHjorth commented 3 years ago

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: `

`

Why is nuxt-image referencing non existent _ipx folder?

JosefHjorth commented 3 years ago

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.

shadow81627 commented 3 years ago

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?

JosefHjorth commented 3 years ago

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

shadow81627 commented 3 years ago

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.

JosefHjorth commented 3 years ago

Switched to cloudinary and it worked much better. Thanks.

ChristopherCapito commented 3 years ago

@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?

shadow81627 commented 3 years ago

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

salv0 commented 3 years ago

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 :)

elglogins commented 1 year ago

Any updates here?

WieFel commented 10 months ago

+1

dinkar030501 commented 6 months ago

any update?

oxedom commented 1 month ago

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