Home > Software engineering >  How to get Nuxt-img to work on nuxt3 generate?
How to get Nuxt-img to work on nuxt3 generate?

Time:10-26

i am trying to use nuxt-image on NUXT3, but it seems it doesn't work with the generate command. Images work during dev, but get a 404 when using nuxt generate.

in my nuxt config i have

modules: ["@nuxt/image-edge"],  
image: {
    dir: "assets/images",
  },

then in my files i have

<NuxtImg
      format="webp"
      
      src="/website/home/above-fold-illustration-mobile.png"
      alt="illustration"
      aria-hidden="true"
    />

So i am wondering if anyone else had a problem or if this is just a compatibility issue with nuxt-image and nuxt3 generate

CodePudding user response:

this is not yet supported, waiting on https://github.com/nuxt/image/pull/614

CodePudding user response:

Reading this part of the documentation

For static provider, if images weren't crawled during generation (unreachable modals, pages or dynamic runtime size), changing dir from static causes 404 errors.

There are other few bugs if you change dir to something else than static apparently.
Can't you stick to static? Will probably avoid you quite some issues IMO.

  • Related