简体   繁体   English

部署到服务器时,Laravel 项目中的 vue 组件未更新

[英]vue component in Laravel project not update when I deploy to server

I'm developing project using vuejs and Laravel.我正在使用 vuejs 和 Laravel 开发项目。 everything worked fine on my laptop and when I upload code to server (Digital Ocean) at that first time.在我的笔记本电脑上一切正常,当我第一次将代码上传到服务器(Digital Ocean)时。

Otherwise, when I update some Vue component in resources/components folder and upload it to server again.否则,当我更新resources/components文件夹中的某些 Vue 组件并将其再次上传到服务器时。 It's seem component is not update on the server when I refresh the browser.当我刷新浏览器时,似乎服务器上的组件没有更新。

my code in \\ webpack.mix.js is我在 \\ webpack.mix.js 中的代码是

mix.js('resources/js/app.js', 'public/js')
    .sass('resources/sass/app.scss', 'public/css');

if (mix.inProduction()) {
    mix.version();
}

and I try to run npm run dev or npm run prod on the server after I push the nw code on it as well.我也尝试在服务器上运行npm run devnpm run prod ,然后我也将 nw 代码推送到服务器上。 It doesn't work.它不起作用。

I also try to clear browser cache and reload url again, it doesn't work also.我也尝试清除浏览器缓存并再次重新加载 url,它也不起作用。

Please give me an advice how should I do.请给我一个建议,我该怎么做。

Regards.问候。

Well its not a good idea to upload a laravel/vuejs project at shared hosting.好吧,在共享主机上上传 laravel/vuejs 项目并不是一个好主意。 Although doing such process can save your life.虽然做这样的过程可以挽救你的生命。

  1. Run php artisan serve view:clear运行 php artisan serve view:clear
  2. Do changes at your local file and then npm run watch.在本地文件中进行更改,然后 npm run watch。
  3. after uploading all the changes to server, always replace public/css/app.css & public/js/app.js files.将所有更改上传到服务器后,始终替换 public/css/app.css 和 public/js/app.js 文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM