@hiromiya0628

Are you sure you want to delete the question?

If your question is resolved, you may close it.

Leaving a resolved question undeleted may help others!

We hope you find it useful!

【Rails6 + Webpacker + Capistrano】Capistranoで bin/webpack を実行する方法

課題

Rails6 + Webpacker で構築しているアプリをCapistranoで本番環境を展開するとmanifest.jsonに差異が発生しBootstrapなどが適用されない。

現在の対応

以下の通り、展開後にbin/webpackを実行して無理矢理適用している。

config/deploy.rb
  desc 'webpack build'
  task :build do
    on roles(:app) do
      with rails_env: fetch(:rails_env) do
        within current_path do
          execute 'export RAILS_ENV=production; $HOME/.rbenv/shims/ruby /var/www/xxxxx/current/bin/webpack' 
        end
      end
    end
  end

  after :publishing, :build

質問

私が知らないだけで推奨の方法があると推測しています。
どなたか教えていただけると助かります。

0 likes

No Answers yet.

Your answer might help someone💌