NuxtN
Nuxt16mo ago
george.x.r

Nuxt Image does not optimize my images

hey guys, does anyone know why nuxt image doesn't optimize my images?
I added the module as per documentation and this is my config:
 ssr: false,
  nitro: {
    static: true,
  },
image: {
    strapi: {},
    format: ["webp", "avif", "png", "jpeg", "jpg", "svg"],
    domains: [`${process.env.NUXT_STRAPI_URL}`], // For Strapi-hosted images
    provider: "ipx", // For client-side optimization
  }

 <NuxtImg
      :src="getStrapiMedia(`${data.hero_image.data.attributes.url}`)"
      :alt="data.hero_image.data.attributes.alternativeText"
      class="w-full max-w-[339px] sm:max-w-[500px] md:max-w-[1080px] rounded-t-xl rounded-tr-xl"
    />

getStrapiMedia returns the full url of the requested media (basically it appends the correct url in the value given if necessary.

during the nuxt generate --prerender process there aren't any images been generated in the .output folder (optimized images I mean) and the images showing at the user are the same as they are in the CMS. Most images are .svg and they can be 2 MB worth of size which I do not want that.

Any clues why they don't get optimized during the generate process?
Was this page helpful?