Why does the alpinejs ESM module require more than just an import? #4349
Replies: 2 comments
-
The cdn autostart,s the module version doesn't so people can do import Alpine from "alpinejs"
... your code, define Alpine.data, stores, custom magic/directives, etx
Alpine.start() without exposing Alpine on the global object. It's a design choice. |
Beta Was this translation helpful? Give feedback.
-
Because then you can't do any setup. I'd actually argue that HTMX is not good, because of how it self initializes always. It requires more working around how it works than Alpine does. Their extensions are even worse... HTMX is very much a cool concept, but I think it's engineering is pretty awful. (I say this as a contributor) |
Beta Was this translation helpful? Give feedback.
-
I can add the htmx module to my website by adding it to vite's
main.js
with justFor alpinejs, a simple
import "alpinejs"
is not enough, and I must add additional code:Was this a deliberate design choice? Or was this necessary, because there is something preventing it from having it a simple
import "alpinejs"
, as it does with htmx?Beta Was this translation helpful? Give feedback.
All reactions