bigskysoftware / bigskysoftware/htmx-extensions

[ need Help] Use vite @rollup/plugin-inject with htmx-ext-sse

Open
#169 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
284
Forks
88
PR merge metrics
No merged PRs in 30d

Description

I tried a lot solution, and asked GPT4o a lot, but none of them work.

because htmx-ext-sse is a side-effect module, there is no way to inject this.

I used it like this:

```js
plugins: [
inject({
exclude: ["src/**/*.scss", "src/**/*.css"],
htmx: "htmx.org",
htmx_sse: "htmx-ext-sse",
_hyperscript: "hyperscript.org",
copyCodeButton: "./copyCodeButton.js",
stork: "./stork.js",
mixManifest: "virtual:mix-manifest",
}),
...
]
```

but, get error: `` "default" is not exported by "node_modules/htmx-ext-sse/dist/sse.esm.js"``.

I try inject like following code (please check screenshot), not work too.

Image

Can any one help on how to use that? I am waiting use SSE feature for several days, because I use `@rollup/plugin-inject` to inject,
I can't add code into app.js directly like following

```
import `htmx.org`;
import `htmx-ext-sse`;
```

because this will cause all inject package invalid.

Thanks

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the build using the shown @rollup/plugin-inject configuration and inspect node_modules/htmx-ext-sse/dist/sse.esm.js, along with the app.js imports mentioned in the issue. Determine how the side-effect module is exposed to the inject setup without triggering the reported default-export error; done means the build succeeds and the htmx SSE feature works.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, rollup, vite
Domain
frontend, tooling, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.