F
Filamentβ€’2mo ago
Tomi Filppu

"Alpine is not defined"

Hi! I have an older Laravel project where Filament 3 used to work fine. Suddenly it stopped working, and all Filament views threw a JS error about Alpine not being found:
Uncaught ReferenceError: Alpine is not defined
at livewire.js?id=df3a17f2:9434:30
at livewire.js?id=df3a17f2:10218:3
Uncaught ReferenceError: Alpine is not defined
at livewire.js?id=df3a17f2:9434:30
at livewire.js?id=df3a17f2:10218:3
I upgraded to Filament 4 and the update went smoothly, but the issue still remains. Some of the things I've tried so far: * php artisan filament:upgrade * php artisan filament:optimize-clear * php artisan filament:clear-cached-components * php artisan vendor:publish --tag=livewire:assets * Added \Livewire\Livewire::forceAssetInjection(); * Removed resources/views/vendor and public/vendor * Cleared browser cache and tested in multiple browsers * Recompiled all frontend assets * Toggled inject_assets in livewire.php config (true and false) * Uninstalled Filament completely (and removed all code references to it) and did a fresh Filament 4 install. On the actual app, Alpine and Livewire works perfectly. The error only appears in Filament. * I originally started this project on Laravel 7, but it's currently upgraded to Laravel 12. * It uses the older project structure (not updated to the Laravel 11/12 structure). At this point I feel like I must have messed something up, since I can't really find anyone else running into this issue. But I'm pretty much out of ideas on what to try next. Any suggestions would be greatly appreciated! πŸš€
2 Replies
Dan Harrin
Dan Harrinβ€’2mo ago
Yeah sorry, have not seen this issue before. Can you please open an issue with a reproduction repository?
Tomi Filppu
Tomi FilppuOPβ€’2w ago
Thanks for the reply, @Dan Harrin! I finally had time tonight to dig deeper into this. The culprit seems to be the show_progress_bar setting in livewire.php. Setting it to false triggers the problem. Everything works if it's true or if I remove the data-no-progress-bar attribute from the Livewire script tag by manually editing Livewire\Mechanisms\FrontendAssets\FrontendAssets (tested just for confirmation). I'm not sure why this happens, but it's reproducible. I created a fresh Laravel 12 project, installed Filament 4, and changed only show_progress_bar to false, and saw the same behavior. So it seems like it's not specific to the project after all, but kind of odd if I'm the only Filament user who's ever hidden the progress bar πŸ˜„

Did you find this page helpful?