Make htmx a peer dependency of each extension#173
Open
scrhartley wants to merge 1 commit intobigskysoftware:mainfrom
Open
Make htmx a peer dependency of each extension#173scrhartley wants to merge 1 commit intobigskysoftware:mainfrom
scrhartley wants to merge 1 commit intobigskysoftware:mainfrom
Conversation
✅ Deploy Preview for htmx-extensions canceled.
|
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.
Description
PR #123 made htmx a dependency of each extension instead of a dev dependency.
One reason given was to ensure a minimum version of htmx is installed that's compatible with the extension.
Unfortunately this doesn't work in practice, so rather than flagging any version mismatch, if there's a conflict NPM will instead create its own nested version of htmx for the extension and that will end up in the bundle as well.
Changing the dependency to a peer one solved the problem and extensions/plugins are the intended use case for peer dependencies.
With my own test specifying a v1 release for htmx with a v2 of the SSE extension,
both a v1 and v2 release of htmx ended up in the final bundle, increasing bundle size from 65K to 115K.
Htmx version: 1.9.2 / 2.0.6
Used extension(s) version(s): 2.2.3 of SSE, plus a WIP version of my own extension
Testing
I tested with my own extension to verify the behavior of normal vs. peer dependencies.
I ran
npm installandnpm run testfor each extension.Checklist
npm run test) and verified that it succeeded