DEV Community

StuartCreed
StuartCreed

Posted on • Edited on

3 2

Laravel v8 (with Sail and BrowserSync), VueJS v3 with Vue Loader boilerplate.

Github dist: https://github.com/StuartCreed/Vue3Laravel8BoilerPlate

To setup, do the following:

Install docker

composer install
npm install
./vendor/bin/sail up
npm run watch
Enter fullscreen mode Exit fullscreen mode

Extra Info - Sail config

docker-composer.yml file changed to use port '8081:80' so that the app runs on localhost:8081, as I have another program that uses localhost:8080 (the default for Sail).
See https://dev.to/stuartcreed/using-laravel-sail-docker-composer-for-laravel-on-a-existing-application-24k5 for more information.
This link will also help you if you have any other port conflicts.

Sources

This is an adaptation of:
https://dev.to/boussadjra/how-to-setup-vue-3-with-laravel-8-4ne6
https://github.com/boussadjra/laravel-vue-3-starter/blob/main/webpack.mix.js

A summary of this is:

npm i -D laravel-mix@next vue@next @vue/compiler-sfc vue-loader@next
Enter fullscreen mode Exit fullscreen mode

Ensure package.json includes:

"scripts": {
    "development": "mix",
    "watch": "mix watch",
    "watch-poll": "mix watch -- --watch-options-poll=1000",
    "hot": "mix watch --hot",
    "production": "mix --production"
}
Enter fullscreen mode Exit fullscreen mode

webpack.mix.js should contain

const mix = require('laravel-mix');
mix.js('resources/js/app.js', 'public/js').vue();
Enter fullscreen mode Exit fullscreen mode

The minimum content of resources/js/app.js:

import { createApp } from 'vue';
import App from './components/App.vue'
createApp(App).mount("#app")
Enter fullscreen mode Exit fullscreen mode

Laravel Sail:
https://laravel.com/docs/8.x/sail

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay