如何在托管中更改vue项目

发布于 2025-01-20 19:36:02 字数 86 浏览 2 评论 0 原文

我有一个发布在 Digital Ocean 上的 vue 项目。主要问题是当我在 FileZilla 上进行一些更改时,它不会影响网站。我该如何解决这个问题?

I have vue project which published on Digital Ocean. The main problem is when i make some changes on FileZilla it is not affect on website. How can i solve this issue?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

z祗昰~ 2025-01-27 19:36:02

这本身并不是问题。这就是现代 Web 开发的工作方式。 Vue.js(还有 Nuxt)现在正在使用捆绑器(Webpack、Vite 是最常见的),因此要投入生产,每次向其推送内容时都需要进行捆绑。

如果您通过 FTP 或 SSH 上传内容并编辑某些源代码,则需要捆绑步骤才能对实际 Web 应用程序进行任何更改。

后端语言可能不需要这样做,例如您可以通过 SSH 连接到服务器并更改一些 .php 文件,如果您 F5 页面,它将实时更新。但这不是前端 JS 代码的工作方式,它需要优化。

另一件事,通过 SSH/FTP 发送代码实际上并不是一个好的工作流程,因为它不容易跟踪,没有版本控制,在出现错误等情况下不会触发任何构建标志...
最好的方法是在一些 CI 中包含一个 git 存储库 + 一些构建步骤。
它的一个常见平台是 Netlify,您连接一个 Github 存储库,您告诉要使用哪个命令构建项目,每次推送一些代码时,它可能会通过 Github Actions 在自动发布到生产环境之前(在您的网络应用程序上更新)。

众所周知,这个工作流程有很多好处,但实际上也是现代 Web 前端开发的官方/常规方法。

This is not an issue per-se. This is just the way how modern web development works. Vue.js (but also Nuxt) is using a bundler right now (Webpack, Vite are the most common), hence to go to production it needs to be bundled each time you push something to it.

If you upload something via FTP or SSH and edit some source code, a bundle step will be required in order to get any changes on the actual webapp.

Backend languages may not need that, for example you could SSH into a server and change some .php file, if you F5 the page it will be updated in real time. But this is not how frontend JS code works, it needs to be optimised.

Another thing, sending code via SSH/FTP is not really a good workflow because it is not easily trackable, no version-controlled, will not trigger any build flags in case of an error etc...
The best approach is to have a git repo + some build step included in some CI.
A common platform for it is Netlify, you connect a Github repo, you tell which command to use to build the project and each time you push some code, it may do some checks/tests/optimizations/etc... via Github Actions before being released automatically to production (updated on your webapp).

This workflow have a lot of benefits as one may tell but is also de-facto, the official/regular approach for modern Web development on the frontend.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文