(Laravel Livewire) Alpinejs - install via NPM #3244
Replies: 2 comments 3 replies
-
Are you using a javascript bundler? like laravel mix To use So you need to prebundle it or make sure the files all have proper web paths |
Beta Was this translation helpful? Give feedback.
-
..Playing with downloaded library PhpStorm offers to download external libraries, which I did for Alpine Then, I copied the content from that file and pasted it in I assume that something is missing in the building process.. Once again, this is just my check, not a final solution. Anyway, maybe this will help someone to understand my problem. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Until now I used CDN but the problem popped up last Friday (CloudFlare was returning an error for all unpkg links). I decided to install AplineJS via NPM.
What have I done:
Then I created the file apline.js (/resources/js/alpine.js) and added the following:
In the layout file I remove this:
And add this:
<script type="text/javascript" defer src="{{ asset('js/alpine.js') }}"></script>
At the end:
npm run dev
Now some functions not working properly and I get this error in the console:
How can I achieve exactly the same behavior as when using a CDN?
Do I need to install another module or something else?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions