fix(alpinejs): start on DOMContentLoaded (#13014)

Co-authored-by: Florian Lefebvre <contact@florian-lefebvre.dev>
This commit is contained in:
jasonlav 2025-01-22 00:46:42 -07:00 committed by GitHub
parent 8fb3bea857
commit 820eee334b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
"@astrojs/alpinejs": patch
---
Fixes an issue with user scripts running after `Alpine.start()`

View file

@ -98,7 +98,7 @@ export default function createPlugin(options?: Options): AstroIntegration {
import { setup } from 'virtual:@astrojs/alpinejs/entrypoint';
setup(Alpine);
window.Alpine = Alpine;
Alpine.start();`,
document.addEventListener('DOMContentLoaded', () => Alpine.start());`
);
updateConfig({
vite: {