Hot reload issue when using quasar with laravel and sanctum

874 views Asked by At

I'm trying to use Quasar with vue and vuex tied into a Laravel API and Sanctum for authentication. It's working well but I ran into an issue where the Quasar hot reload stopped working - the quasar build command followed by 'npm run dev' (or prod), was the only way to build and test. This was obscenely time consuming so after much experimentation I realized I could get the hot reload working if I rename my public directory temporarily as I initialize Quasar with hot reload, then name it back - if I don't, I get a CORS error on login, among the obvious issues of broken images and the like.

In order to get Quasar and Laravel Mix to work nicely together, I have this code in my webpack.mix.js:

mix
  .copy('dist/spa/index.html', 'resources/views/app.blade.php')
  .copyDirectory('dist/spa', 'public');

This takes the index.html from the spa dist created by quasar and copies it to the laravel blade template and copies the spa dist content to the public directory to be served on the virutal host.

I'm not really understanding how the quasar hot reload works and where it serves those files. If that public folder is there when I run the hot reload, the hot reload server that launches just shows the last rendered version from mix rather than the live files I'm working on. Right now it's a couple extra steps to get my hot reload environment working, so not the end of the world, but certainly a nuisance and I'd prefer to understand how it all works, but I'm not finding much on the Quasar docs about that.

The quasar dev command I'm using to start up the hot reload environment that uses the virtual host for it's API:

quasar dev -H console.brightsideresumes.localhost 

** Edit: I'm now noticing that when I do get the hot reload working, it works great if I'm making changes to vue template files, but as soon as I edit one of the files in the store, I get logged out and have to restart the quasar dev server, changing the directory and all. Quite frustrating.

0

There are 0 answers