Skip to content

Commit

Permalink
fix(alpinejs): start on DOMContentLoaded (#13014)
Browse files Browse the repository at this point in the history
Co-authored-by: Florian Lefebvre <[email protected]>
  • Loading branch information
jasonlav and florian-lefebvre authored Jan 22, 2025
1 parent 8fb3bea commit 820eee3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/tall-bears-return.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@astrojs/alpinejs": patch
---

Fixes an issue with user scripts running after `Alpine.start()`
2 changes: 1 addition & 1 deletion packages/integrations/alpinejs/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down

0 comments on commit 820eee3

Please sign in to comment.