[Vuejs]-Adding vue js to an almost production-ready Laravel application

0πŸ‘

βœ…

I finally got it to work in several steps. First I installed Laravel UI composer require laravel/ui "^1.2" remember it is "1.2" because Laravel version is 6, 2.0 version will throw this error: How to solve problems while installing ui in laravel? Then I created the following folders and files(Only if they don’t exist in your application in resources folder(resources/js/app.js,resources/sass/_variables.scss, and resources/sass/app.scss) as explained here:
https://laravel-news.com/laravel-5-7-resources-directory-changes, [Note that this structure differs from version 7.] I then updated webpack.mix.js as follows:

let mix = require('laravel-mix');

mix.js('resources/js/app.js', 'public/js')


.sass('resources/sass/app.scss', 'public/css');

After that I ran php artisan ui vue that installed vue ui and I finally did npm i && npm run dev and thats all. In case sass-loader throws an error, uninstall and install version 7. That is if you are using Laravel V6 And that is it! Hope this helps someone who might encounter the same.

0πŸ‘

I suggest reading the documentation about Laravel Mix. This is a front-end framework baked into the Laravel Framework.

https://laravel.com/docs/7.x/frontend#introduction

I would recommend that you first try this out in a dummy project or different GIT branch.

You can use the following command to generate a basic set-up:

php artisan ui vue

Leave a comment