bigskysoftware / bigskysoftware/htmx-extensions
Uncaught TypeError: htmx.defineExtension is not a function
- Dominant language
- JavaScript
- Stars
- 284
- Forks
- 88
- PR merge metrics
- No merged PRs in 30d
Description
I have the following JS file for my frontend:
```js
// custom.js
window.htmx = require('htmx.org');
```
```js
// 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
sse.js:12
sse.js:288
app.js:6627
```
I'm not sure how to proceed. I followed the instructions for [Webpack](https://htmx.org/docs/#webpack) (despite using esbuild), and I'm surprised that `htmx` does not get picked up.
For reference, I have the following in my devDependencies:
```json
"htmx-ext-sse": "^2.2.2",
"htmx.org": "^2.0.2",
```
Contributor guide
Research direction
Start with custom.js and app.js, then inspect htmx-ext-sse's sse.js at the reported lines and compare the htmx Webpack guidance. Reproduce the esbuild bundle with htmx.org 2.0.2 and htmx-ext-sse 2.2.2; done means the extension loads without the TypeError and SSE can be used.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100