Feature: Force precompile for webpacker
Epigene opened this issue · comments
Hi,
Mina version 1.0.7
We have a Rails application that uses React via webpacker.
Normally we performed our deploys with mina deploy
with "smart precompile", skipping precompilation if there are no changes in asset files, but now we need full precompilation to occur on every deploy for webpacker to work.
Currently we are working around the issue by running mina deploy force_asset_precompile=true
, but it would be nice to make changes to deploy.rb
to change the default behaviour.
We got the same problem with you. We are still doing a workaround by using force_asset_precompile=true
. @d4be4st Would it be possible for you to take a look at this problem?
To my knowledge, the only problem here is that mina considers only the public/assets
path as an asset output path, while webpacker output files are by default stored at public/packs
.
The relevant piece of mina source is https://github.com/mina-deploy/mina/blob/master/tasks/mina/rails.rb#L8 -- the compiled_asset_path
is a single directory instead of an array.
A workaround for this is to put the following inside your deploy.rb
:
set :shared_dirs, fetch(:shared_dirs, []).push('public/assets').push('public/packs')
But of course it would be nice to offer out-of-the-box compatibility!
👍 I'd like this too.
Hey
you could just set up the variable in your deploy.rb
file
set :force_asset_precompile, true