Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using html version 2.0.4 with ws.js version of 2.0.4 but it's saying I am using version 1 #144

Open
saipanman95 opened this issue Feb 14, 2025 · 3 comments

Comments

@saipanman95
Copy link

I was testing out latest version ws.js and I got this error message:
WARNING: You are using an htmx 1 extension with htmx 2.0.4. It is recommended that you move to the version of this extension found on https://htmx.org/extensions

I am clearly using 2.0.4 so this caught me off guard. I was debugging the code and "I think" this is wrong.

Image

@Telroshan
Copy link
Collaborator

Hey, you're indeed using htmx 2 but it seems that you are still using the v1 extension.

As the log says, you can head to https://htmx.org/extensions/ and use the v2 ws extension that will be compatible with htmx 2
As per the ws docs

<script src="https://unpkg.com/[email protected]/ws.js"></script>

See how the extensions are now also published as their own package and versioned

Before, the extensions were hosted as subfiles of the htmx library itself, see the v1 docs where the old import method was

<script src="https://unpkg.com/[email protected]/dist/ext/ws.js"></script>

So it might be that you are importing https://unpkg.com/[email protected]/dist/ext/ws.js (that is still here for backwards compatibility only, thus the warning log and the link to the extensions page), instead of https://unpkg.com/[email protected]/ws.js

Hope this helps!

@saipanman95
Copy link
Author

interesting...I only have what is loaded through webjars. Is webjars version suspect?

org.webjars.npm htmx.org 2.0.4

https://www.webjars.org/listfiles/org.webjars.npm/htmx.org/2.0.4

@Telroshan
Copy link
Collaborator

Yeah it's the hierarchy you can find in the dist folder of the htmx repo
You'll find more details in the README of that same folder, as to why those files are even here to begin with

Using webjars like you do, you'll find the v2 ws extension at https://www.webjars.org/listfiles/org.webjars.npm/htmx-ext-ws/2.0.2

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

No branches or pull requests

2 participants