如何在本地环境中使用 vs code 中的 laravel 在 Vue 应用程序上进行实时重新加载?

sri*_*ama 3 laravel vue.js visual-studio-code

你好,我正在使用 laravel 后端开发 vue 应用程序。我已经在 localhost:8000 上使用 php artisanserve 为应用程序提供服务,并使用 npm run watch 观看我的资产,但 我希望浏览器在保存后重新加载 vue 更改。任何帮助将不胜感激 。谢谢

Jar*_*rad 5

接受的答案适用于 laravel-mix 5,但对于那些现在使用 laravel-mix 6 的人:

\n

package.json 中 \xe2\x80\x9cscripts\xe2\x80\x9d 部分下的 \xe2\x80\x9chot\xe2\x80\x9d 脚本应为:

\n
"hot": "mix watch --hot",\n
Run Code Online (Sandbox Code Playgroud)\n

然后在你的终端中运行命令:

\n
npm run hot\n
Run Code Online (Sandbox Code Playgroud)\n

现在,当您在 IDE 中进行更改并保存时,浏览器将更新更改,而无需重新加载页面

\n

欲了解更多信息: https://laravel-mix.com/docs/6.0/hot-module-replacement

\n