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
2 Answers
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
-
1Make 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
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.
-
1A link to a solution is welcome, but please ensure your answer is useful without it: add context around the link so your fellow users will have some idea what it is and why it’s there, then quote the most relevant part of the page you're linking to in case the target page is unavailable. Answers that are little more than a link may be deleted.– 4b0Commented Jan 21, 2021 at 10:45