Ever since AlpineJS upgraded to Alpine 3, I haven't been able to get it working with Rails 6 and webpacker, I've only been able to get it working when linking to the CDN version of Alpine.
In the past with AlpineJS 2 I've just had to run yarn add alpinejs then put require('alpinejs') in javascript/packs/application.js.
From everything I've read, it seems that when using Turbo on Rails 6.1 I need to do this:
// Alpine JS
import 'alpine-turbo-drive-adapter'
require('alpinejs')
(After installing the packages, obviously). I'm loading my javascript in my html header with <%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>.
But, that still doesn't work. Does th AlpineJS NPM package just not work with webpacker and Rails?
How do I get this working instead of loading from the Alpine JS CDN?
from How to Install Alpine JS 3 with Rails 6.1 via Webpacker
No comments:
Post a Comment