-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: update deployment instructions for capistrano in vite v5 #454
docs: update deployment instructions for capistrano in vite v5 #454
Conversation
@tenkiller Could there be a path conflict with Sprockets searching for the manifest? set :assets_prefix, 'vite'
set :assets_manifests, ["public/#{fetch(:assets_prefix)}/.vite/manifest*.*"]
|
@rgioia Good point. I had considered including the path for the Rails Asset Pipeline (i.e. sprockets), but we weren't getting any errors on deployment for our setup, so I overlooked it. By setting
But, we don't want to add this back in as given because
|
@tenkiller Thank you! I managed to do what I needed; I successfully switched from Webpacker to Vite. |
I don't use Capistrano myself, but if I understand correctly, the instructions are not complete if the app needs to support sprockets, as Given that some users still mix
Happy to accept a PR that removes the example setting |
d55cc92
to
ebe50b8
Compare
@ElMassimo There's some odd behavior I'm experiencing with capistrano-rails and the Here is what I have provided in my deploy config.
There are files that match these paths on the server after $ ls public/vite/.vite/manifest*.json public/assets/.sprockets-manifest*
public/assets/.sprockets-manifest-415461b893c1f289238ea242950f61cb.json
public/vite/.vite/manifest.json
public/vite/.vite/manifest-assets.json But these are the only files capistrano-rails backs up to $ ls assets_manifest_backup/
manifest-assets.json manifest.json I have no idea why this is the case. I realize this isn't your problem, but an issue with capistrano-rails. I'm unsure if you should even mention capistrano in your own docs. Let me know what you think, and I can either close this PR or amend it, based on your recommendation. |
Hi, I'm a maintainer of capistrano-rails. I agree with @ElMassimo's comment above about setting
I believe the best way forward is to add those recommendations to the Vite Ruby docs. @tenkiller, regarding the problem of capistrano-rails failing to find and backup the sprockets manifest, that might be because the sprockets manifest starts with a
If a bug still seems to be lurking there, please feel free to report it at https://github.com/capistrano/rails, since I don't think that particular issue is Vite-related. |
@mattbrictson Thanks for responding, Matt. The sprockets manifest is definitely not on the server. $ ls -a assets_manifest_backup/
. .. manifest-assets.json manifest.json The funny thing is, if I list the sprockets manifest path first in the |
Thanks everyone for the discussion! Updated the docs to avoid overriding |
Description 📖
When using Vite v5 and above, Capistrano is not aware that the location of the asset manifest files has moved, and fails on deployment with
Rails assets manifest file not found.
Background 📜
When using Vite v5 and above, asset manifest files are output to a
vite/.vite/
subdirectory, by default. Meaning that themanifest.json
andmanifest-assets.json
files that used to reside underpublic/vite/
now reside underpublic/vite/.vite/
.The Fix 🔨
Update documentation to reflect that there is a difference between the Capistrano configuration when using Vite v4 and Vite v5. The fix when using Vite v5 and above is to set the Capistrano
:assets_manifests
option. The path(s) need to be relative or absolute.