nuxt / image

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

image.dir Does not work in production #1320

Open senher opened 5 months ago

senher commented 5 months ago

I put my image resources in the resources/images directory My nuxt.config.ts: modules: ["@nuxt/image"], image: { dir: "resources", }, in page: <NuxtImg src="/images/test.jpg" /> It will render <img src="/_ipx/_/images/test.jpg"/> It works fine in development mode and the images can be accessed After npm runs build, the image will display 404 in production mode

"@nuxt/image": "^1.5.0", "nuxt": "^3.11.2",

scottyzen commented 5 months ago

@senher Is it Netlify? I'm having issues today too.

scottyzen commented 5 months ago

Images are still not working.

Anyone else having issues with images not loading on Netlify? I'm using the same image transformation service that I've been using for a while now and it's not working anymore. I'm not sure if it's related to the changes that were made to the image transformation or redirects on Netlify's side.

Working image

The only difference is the slash after the domain name which you would expect to be the working image.

senher commented 5 months ago

@senher Is it Netlify? I'm having issues today too. 是网络化吗?我今天也遇到问题了

No, I tested it locally and deployed it to a test server,

yangxiuxiu1115 commented 3 weeks ago

any progress on this issue so far, I'm experiencing the same problem

scottyzen commented 2 weeks ago

any progress on this issue so far, I'm experiencing the same problem

For Netlify you need to add the domain to the netlify.toml file like below:

[images]
  remote_images = ["https://example.com/.*"]
yangxiuxiu1115 commented 2 weeks ago

Thanks, unfortunately I'm not using Netlify. when setting up image.dir I noticed that the corresponding image resource doesn't exist in the .output folder, it looks like a very simple problem, I think maybe I underconfigured some options but I don't know much about nuxt!