Closed bernhardh closed 1 year ago
Well I am not sure, it must be a conflict with filament, since a "naked" page works...
@bernhardh Can you add the alpine (using defer <script src="..." defer>
) script below the wireui script?
AlpineJS is included in the app.js of filament and is inserted at the very end of the body tag (right before the closing </body>
). So it is below the wireui script. The problem seems to be the defer
, which is missing, but not in my control ;)
I have a same problem, then I put alpinejs in another js like alpinejs.js and add in the vite.config. I put @vite(['resources/js/alpine.js']) below {!! WireUi::directives()->scripts() !!} or @wireUiScripts, but im using {!! WireUi::directives()->scripts() !!}. It works for me before im searching about defer setting in vite, so i dont need setting defer in my vite
thanks a lot. my problem has resolved now
so, you must defined your first asset laravel @Vite(['resources/js/alpine.js']), after @wireUiScripts
in your app.blade
I have a same problem, then I put alpinejs in another js like alpinejs.js and add in the vite.config. I put @Vite(['resources/js/alpine.js']) below {!! WireUi::directives()->scripts() !!} or @wireUiScripts, but im using {!! WireUi::directives()->scripts() !!}. It works for me before im searching about defer setting in vite, so i dont need setting defer in my vite
Yes, you save my time. Thank alots
hi.,
This isue is realy annoying and wasted lot of time. I have tried the solution as proposed but still getting
Cannot read properties of undefined (reading '$wire')
here is my alpine.js
import Alpine from 'alpinejs'; import focus from '@alpinejs/focus'; window.Alpine = Alpine; Alpine.plugin(focus); Alpine.start();
here is my app.js
import './bootstrap';
and app.blade.php in head tag
@vite(['resources/css/app.css', 'resources/js/app.js']) @wireUiScripts @Vite(['resources/js/alpine.js'])
And following code before body tag
@livewireScripts
I have also added following lines in boot function in AppServiceProvider
Vite::useScriptTagAttributes([ 'defer' => true, ]);
Can anyone please tell me what am I doing wrong?
We are having the same problem when installing WireUI in a fresh Laravel (+Jetstream) installation. Any advice on how to get this working?
I had a similar issue. I think the problem was duplicated Alpine.js, since Laravel Breeze already includes it.
Here is the app.js
:
import './bootstrap';
import Alpine from 'alpinejs';
window.Alpine = Alpine;
Alpine.start();
So all I did was change the app.blade.php
:
<head>
...
<!-- Scripts -->
@wireUiScripts
@vite(['resources/css/app.css', 'resources/js/app.js'])
@livewireStyles
</head>
Now everything works perfectly, no warnings or errors.
@wireUiScripts @vite(['resources/css/app.css', 'resources/js/app.js']) @livewireStyles
Tried it also but got the same error. I end up using x-native-select because of this error.
I'm getting the following errors:
alpine.cdn.min.js:1 Alpine Expression Error: wireui_inputs_maskable is not defined
Expression: "wireui_inputs_maskable({
isLazy: false,
model: window.Livewire.find('dIS7UnMpUEHo10hYL076').entangle('state.phone_confirmation').defer,
emitFormatted: false,
mask: ['(###) ###-####', '+# ### ###-####', '+## ## ####-####'],
})"
alpine.cdn.min.js:5 Uncaught ReferenceError: input is not defined
at eval (eval at <anonymous> (alpine.cdn.min.js:5:637), <anonymous>:3:32)
at alpine.cdn.min.js:5:974
at Xt (alpine.cdn.min.js:1:4899)
at c (alpine.cdn.min.js:5:28429)
at e._x_forceModelUpdate (alpine.cdn.min.js:5:29190)
at alpine.cdn.min.js:5:29402
at r (alpine.cdn.min.js:5:16414)
at Object.jr [as effect] (alpine.cdn.min.js:5:16202)
at P (alpine.cdn.min.js:1:398)
at alpine.cdn.min.js:1:511
This happens on the doc page so I'm assuming it's the library and not my own set up.
Adding this for my future self and anyone else who wants to save 3 hours:
Had the same error after updating to Livewire 3. Solution was to remove loading of Alpine from app.js, because it is actually bundled with Livewire 3 already.
Thanks @rowino for pointing it out ;)
Describe the bug I am trying to implement notification on a new project (with filamentadmin), but I can't get it working. I always get
and
And this even before calling
$this->notification()
orwindow.$wireui.notify({...
, just directly on page load.I have added
<wireui:scripts />
next the the<head>
tag, resulting in:and right after the
<body>
tag I have added<x-notifications />
resulting inAlpineJS ist included at the end of the
</body>
.WireUi Elements like Buttons are working.
Desktop (please complete the following information):
Additional context