-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: remove
vite:clean
rake task as it can potentially break apps
Vite plugins can create additional files, and some of them are never referenced in the manifest. As a result, cleaning files can only be done *safely* by doing it *before* building with Vite, otherwise it can potentially break an app. Deployment setups without a CDN would actually benefit from keeping previous builds. Otherwise, in SPA clients might request an asset or dynamic import chunk that was removed from the server upon deployment, remaining in a broken state until a full-page reload. Container-based deployments don't need `clean`, and they are one of the most common ways to deploy apps nowadays. Taking all of this into account, I've decided to remove this task from `vite_ruby`, preventing broken apps, and easing the maintenance burden of something that I've never used and most users don't need. Closes #438, #490, #404
- Loading branch information
Showing
7 changed files
with
3 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
824b4ef
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ElMassimo Is there a suggested path going forward for those who deploy to servers using Capistrano? Sprocket assets are being cleaned up, but vite isn't anymore, leading to growing public/vite/ folders each time we deploy.
824b4ef
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keeping older assets around for a while is a good practice, especially when using dynamic imports, as clients still using an older bundle of the app could request a file that is no longer available in the most recent bundle. Using a CDN mitigates that because once an asset is served it tends to stay available for a long time (or forever), but only if the referenced asset was requested at least once.
Depending on the plugins that your app is using, it might be safe to use a custom rake task that checks
public/vite
for files with a very oldmtime
, and delete those to release disk space.