FatehAK / vite-plugin-image-optimizer

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

Make peer dependencies agree with vite >= 4 #16

Closed LeoDog896 closed 1 year ago

LeoDog896 commented 1 year ago

Describe the Bug

When installing the plugin with npm i -D vite-plugin-image-optimizer, it throws an error with a mismatching peer version (in the case of me having a vite version v4 and above).

If you are also experiencing this issue, you can just override it with --force.

Steps to reproduce

  1. Initialize a vite v4 project (preferrably NPM)
  2. Run npm i -D vite-plugin-image-optimizer

System Info

Binaries:
    Node: 18.7.0 - /usr/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 9.2.0 - /usr/local/bin/npm
  Browsers:
    Chrome: 110
    Firefox: 107
  npmPackages:
    vite: ^4.3.0-beta.5 => 4.3.0-beta.5 


### Used Package Manager

npm

### Validations

- [X] Read the [docs](https://github.com/FatehAK/vite-plugin-image-optimizer#readme).
- [X] Check that there isn't [already an issue](https://github.com/FatehAK/vite-plugin-image-optimizer/issues) that reports the same bug to avoid creating a duplicate.
FatehAK commented 1 year ago

Hey @LeoDog896 I've taken a look at this issue.

The plugin requires the installed vite version to be >= 3 and I've not included pre-releases.

"peerDependencies": {
   vite: ">=3"
},

Since you are using a beta version 4.3.0-beta.5 of Vite you are facing this issue. You can downgrade to the last production release 4.2.1 which fixes this. Or if you would like to stay at the beta version you can use the --force workaround for now and it should be resolved in the future once a 4.3.0 production release is made.

LeoDog896 commented 1 year ago

Alright, thanks for the clarification! 👍