Alpinejs not working in phoenix (without liveview)

With some googling I found this that quite likely is problem you are facing https://stackoverflow.com/questions/64909690/how-to-import-alpinejs-with-npm

From alpinejs installation docs here Installation — Alpine.js you need to do this

import Alpine from 'alpinejs'

window.Alpine = Alpine

Alpine.start()