vbenjs / vite-plugin-imagemin

A vite plugin for compressing image assets.
MIT License
207 stars 28 forks source link

imagemin config ignored #45

Open kahlan88 opened 1 year ago

kahlan88 commented 1 year ago

I checked this issue https://github.com/vbenjs/vite-plugin-imagemin/issues/1. I tried the config settings provided in the readme of this project and js config as per Vite docs:

import viteImagemin from "vite-plugin-imagemin";
import { defineConfig } from "vite";

export default defineConfig({
  plugins: [
    viteImagemin({
      gifsicle: {
        optimizationLevel: 7,
        interlaced: false,
      },
      optipng: {
        optimizationLevel: 7,
      },
      mozjpeg: {
        quality: 20,
      },
      pngquant: {
        quality: [0.8, 0.9],
        speed: 4,
      },
      svgo: {
        plugins: [
          {
            name: "removeViewBox",
          },
          {
            name: "removeEmptyAttrs",
            active: false,
          },
        ],
      },
    }),
  ],
});
node: 16.16.0
vite: ^4.4.5
vite-plugin-imagemin: ^0.6.1

I tried disabling webp, but it didn't make a difference in my case. I'm using latest version of vite and vite-plugin-imagemin.

I get no errors, and no compression on my production build: example images from build

Any ideas? Have I missed something?