// Image resource files used to compress the output of the production environment
// https://github.com/anncwb/vite-plugin-imagemin
// import viteImagemin from 'vite-plugin-imagemin';
import imagemin from 'unplugin-imagemin/vite';

export function configImageminPlugin() {
  const plugin = imagemin({
    // Default mode squoosh. support squoosh and sharp
    mode: 'squoosh',
    // Default configuration options for compressing different pictures
    compress: {
      jpg: {
        quality: 80,
      },
      jpeg: {
        quality: 70,
      },
      png: {
        quality: 70,
      },
      webp: {
        quality: 70,
      },
    },
  });
  return plugin;
}
