Skip to content

Conversation

scrhartley
Copy link
Contributor

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 install and npm run test for each extension.

Checklist

  • I have read the contribution guidelines
  • I ran the test suite locally (npm run test) and verified that it succeeded

Copy link

netlify bot commented Jul 21, 2025

Deploy Preview for htmx-extensions canceled.

Name Link
🔨 Latest commit c9c184b
🔍 Latest deploy log https://app.netlify.com/projects/htmx-extensions/deploys/687eb2f3ad3d0100087c47eb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant