Make vite a peer dependency#20
Open
cpulvermacher wants to merge 1 commit into
Open
Conversation
Plugin itself is compatible with vite 6 and 7, but without this change, npm might install two conflicting versions of vite, requiring a cast to make it work with TypeScript. peerDependencies makes more sense for plugins: Adding vite-plugin-handlebars as a dependency doesn't itself pull in vite, but npm fails if vite is missing. If both vite and vite-plugin-handlebars are dependencies, dependency resolution will prioritize the directly specified vite version.
Author
|
I've created a temporary fork of the package here https://github.com/cpulvermacher/vite-plugin-handlebars that includes this PR and some version updates. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Greetings from Kyushu, and thank you for making this package!
This PR fixes two issues:
dependenciescan cause npm to install a second, conflicting copy of vite, which can be very hard to debug. For example, installing vite-plugin-handlebars on a project with vite 7 produces:Configuring it in
peerDependencieswill prioritize the version specified in the root project:If the version is incompatible, it will show an error instead of quietly installing an incompatible version. E.g. with vite 4 on the root project: