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

Uncaught TypeError: htmx.defineExtension is not a function #92

Open
tchoutri opened this issue Sep 19, 2024 · 1 comment
Open

Uncaught TypeError: htmx.defineExtension is not a function #92

tchoutri opened this issue Sep 19, 2024 · 1 comment

Comments

@tchoutri
Copy link

tchoutri commented Sep 19, 2024

I have the following JS file for my frontend:

// custom.js
window.htmx = require('htmx.org');
// app.js
import './custom.js';
import 'htmx-ext-sse';

And in the console browser, when I arrive on page where I try to use ext-sse, I see the following:

Uncaught TypeError: htmx.defineExtension is not a function
    <anonymous> sse.js:12
    <anonymous> sse.js:288
    <anonymous> app.js:6627

I'm not sure how to proceed. I followed the instructions for Webpack (despite using esbuild), and I'm surprised that htmx does not get picked up.

For reference, I have the following in my devDependencies:

    "htmx-ext-sse": "^2.2.2",
    "htmx.org": "^2.0.2",
@Telroshan
Copy link
Collaborator

Hey, yes the webpack instructions have changed with htmx 2, there's a documentation update PR that's in progress, you may want to try what's inside, it could work for you

Hope this helps!

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