Skip to content
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

Deploying a webpacker project without sprockets fails #235

Open
chemic opened this issue Sep 11, 2019 · 6 comments
Open

Deploying a webpacker project without sprockets fails #235

chemic opened this issue Sep 11, 2019 · 6 comments

Comments

@chemic
Copy link

chemic commented Sep 11, 2019

Steps to reproduce

Deploy a project with assets built with Webpacker and without sprockets generating anything.

Expected behavior

Deploy succeeds

Actual behavior

Deploy fails because manifest files are missing

 DEBUG [a53efae3] 	cannot access '/home/deploy/appname/releases/20190911225157/public/assets/.sprockets-manifest*'
 DEBUG [a53efae3] 	: No such file or directory
 DEBUG [769a050c] 	cannot access '/home/deploy/appname/releases/20190911225157/public/assets/manifest*.*'
 DEBUG [769a050c] 	: No such file or directory

Hot-Fix

Adding a line to deploy.rb
Rake::Task["deploy:assets:backup_manifest"].clear_actions

@mattbrictson
Copy link
Member

I can think of two solutions:

  1. We already have a :assets_manifests setting. We could add some conditional logic that if :assets_manifests is empty or nil then we skip the backup_manifest task.
  2. We introduce a new set of tasks specifically for webpacker-only projects. If you are using sprockets, you would use require "capistrano/rails/assets" as you do today. If you are using webpacker only, then you would use require "capistrano/rails/webpacker" instead.

I kind of like the second option because we can support the next generation of Rails apps using a clean slate rather than hacking the existing tasks with more and more conditional logic. But, the second option is definitely more work. I do not use Capistrano with webpacker so I would need help from the community to put a PR together.

Option 1 is fairly easy and I could hack something together for that pretty quickly.

Thoughts?

@chemic
Copy link
Author

chemic commented Sep 12, 2019

+1 for the 2nd approach from my side as well, looks cleaner and more future proof :)

@mattbrictson
Copy link
Member

OK I put a you can help! label on this issue to indicate that I am looking for the community to provide a PR. Please open one if you have a suggested implementation! 🙏

@b-nik
Copy link

b-nik commented Nov 4, 2019

Does setting the asset_prefix like recommended below work? It worked for me.

http://blog.tap349.com/webpack/2018/05/22/webpack-troubleshooting/

edit: I actually had to enable sprockets because of various issues without it :(

@patleb
Copy link

patleb commented Dec 17, 2019

This pull request is necessary when using webpacker and set :assets_prefix, 'packs'.

@ghost
Copy link

ghost commented May 14, 2020

Rollback is getting failed when i use set :assets_prefix, 'packs'
Rails assets manifest file (or backup file) not found.
Pls anyone can help me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants