Subwaytime / vite-aliases

Alias auto generation for Vite
https://www.npmjs.com/package/vite-aliases
MIT License
210 stars 12 forks source link

Change Vite Dependency to Peer Dependency #71

Closed ColinKrist closed 8 months ago

ColinKrist commented 9 months ago

The package.json strictly calls out v4 - v5 just got released and I am currently able to run this on my V5 project, but its also pulling in vite v4 alongside v5 which probably doesn't need to happen.

I believe peer dependencies should be used in this case to support multiple major versions

Subwaytime commented 9 months ago

Hey there, thanks for the Issue! I am currently working on a newer version which fixes this problem! Probably gonna drop next weeks.., should also include some fixes for other underlying/related vite issues.

Subwaytime commented 8 months ago

Dependencies have been updated to latest with v0.11.4.

Subwaytime commented 8 months ago

Considering i got a lot of messages regarding Vite 5, i just want to state that this Package fully works with Vite 5 - there are no issues with it.

ColinKrist commented 8 months ago

image

I haven't checked this package in a bit, but vite is still a direct dependency pictured above. That means when Vite has another major version release (v6) everyone is hung out to dry without installing both versions of vite into their node_modules.

I am suggesting a transition to using vite as a peerDependency to enable the usage of version ranges. There's a few pros to this model -

  1. It only installs the user's desired version of vite and not what's specified in this project's dependencies. Fixes issue I've mentioned above
  2. It only allows supported versions of vite to be installed in the user's project. (Not allowing users to use without officially supporting by adding to the dependency range)
  3. A small PR just needs to be opened to add the range and update the example project to validate the plugin still works with the new version of vite.
    "peerDependencies": {
    "dependency-name": "^1.0.0 || ^2.0.0"
    }
ColinKrist commented 8 months ago

Feel free to close this when 0.12 is published - I had some time before lunch to review and see it's now listed as a devDependency for the Plugin type which should resolve the issue that's happening now.

I hadn't dug into the code to check if you were using a utility function from vite, but happy the problem is resolving itself naturally without major changes.

Subwaytime commented 8 months ago

Hey there! Yes that is the current plan, right now there is still some parts used for vite, but these are removed to only types in the next Version 0.12.

Definitely moving vite towards peer :)

Subwaytime commented 8 months ago

Moved this towards peer now as 0.12 will still take some more time!