FatehAK / vite-plugin-image-optimizer

Optimize your image assets using Sharp.js and SVGO.
MIT License
344 stars 15 forks source link

Not type-safe with a typescript config for Vite 4.1.1 #13

Closed nicolasalt closed 1 year ago

nicolasalt commented 1 year ago

Describe the Bug

I have to use ViteImageOptimizer() as PluginOption as a workaround, otherwise VSCode complains (no issues with the actual build):

image

Full config:

import react from '@vitejs/plugin-react';
import { ViteImageOptimizer } from 'vite-plugin-image-optimizer';
import { defineConfig, PluginOption } from 'vite';

export default defineConfig({
  plugins: [react(), ViteImageOptimizer() as PluginOption],
});

Steps to reproduce

System Info

-

Used Package Manager

yarn

Validations

FatehAK commented 1 year ago

Just published a new version with TS typings. Please update the package to v1.1.0 and see if that fixes it. Thanks!

nicolasalt commented 1 year ago

Thanks a lot for the quick fix!

And thanks for this plugin, in my app it worked right away without any additional tuning and reduced the total images size by more than 50% without significant quality drop.

FatehAK commented 1 year ago

Awesome! Great to hear 😃