How to install AlpineJs with Laravel 9 Vite

How to install AlpineJs with Laravel 9 Vite

145

In this tutorial you will learn how to install AlpineJs in laravel 9 and ViteJs.

I am assuming that you have already installed laravel 9 and set it up, now for next step open your bootstrap.js file in resources/js folder and paste following lines:

import _ from 'lodash';
window._ = _;

import 'bootstrap';

// Add this
import Alpine from 'alpinejs';
window.Alpine = Alpine;
Alpine.start();

Now build your asset files

npm run build

You are all set, if you check your website you should see alpines is presented in your assets.


That's all.

- Last updated 3 weeks ago

Be the first to leave a comment.

You must login to leave a comment