Skip to content

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

@zw963

Description

@zw963

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:

   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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions