Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

prs1378's avatar

Livewire Alpine - @script Error

Hi, I am implementing an admin panel in the TALL Stack style and I have encountered a problem. I have componentized with Livewire and I'm using @script.

The issue is that if I place the component-related codes inside app.blade.php, it works, but if I place them inside the component itself using @script, it gives an error.

To explain further, if I write a simple console.log inside @script, it shows up, but I feel that the JavaScript code added to the project with @script is executed after the initial page load. I'm not exactly sure what to do, can someone guide me?

My Laravel version is 11.14 and my Livewire version is 3.5.

0 likes
4 replies
prs1378's avatar

@MohamedTammam

So what should I do now so that my AlpineJS code works correctly?

pastebin.com/h6eu7yve

Snapey's avatar

it gives an error.

which is.....

Please or to participate in this conversation.