3

hi i m developing the vue app with laravel backend . I have served the app with php artisan serve at localhost:8000 and watched my asset with npm run watch but i want the browser to reload the vue changes after i save . any help will be appreciated . thanks

1

2 Answers 2

5

The accepted answer is for laravel-mix 5, but for those now using laravel-mix 6:

Your “hot” script available under the “scripts” section in package.json should be:

"hot": "mix watch --hot",

then in your terminal run the command:

npm run hot

Now when you make a change in your IDE and save, your browser will update the change without having to reload the page

For more info: https://laravel-mix.com/docs/6.0/hot-module-replacement

1
  • 1
    Make sure your 8080 port is available, otherwise it won't work and Mix won't notify you of the underlying problem. In that case you'd need to override hmrOptions using Mix's options() helper. Commented Dec 16, 2021 at 17:16
0

Make sure you have “hot” script available under the “scripts” section in package.json

"hot": "cross-env NODE_ENV=development webpack-dev-server --inline --hot"

For more info https://www.webdesignvista.com/vue-hot-reload-with-laravel-mix/ I did the same with my project a couple of months ago. Hope this article helps you.

1

Not the answer you're looking for? Browse other questions tagged or ask your own question.