hyperstack-org / hyperstack-org/hyperstack

Can't deploy to Heroku and other places

Đang mở
#227 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
bug good first issue
Ngôn ngữ chính
JavaScript
Star
538
Fork
41
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Problem is that webpacker enhances `rake assets:precompile` to build the assets first, then builds the packs.

This doesn't work as Hyperstack references the packs from the application.js (via the `hyperstack-loader.js` file.) So the application.js file will not reference the packs.

The solution is to build the packs first, by adding the following lines the Rakefile in the application root directory:

```ruby
puts "Warning: Hyperstack is running yarn install and webpacker:compile BEFORE assets:precompile"
# determine if we should use built in yarn:install or use webpacker:yarn_install
yarn_installer = (Rails::VERSION::MAJOR == 5 && Rails::VERSION::MINOR == 0) ? 'webpacker:yarn_install' : 'yarn:install'
# install yarn and compile packs BEFORE assets:precompile
Rake::Task["assets:precompile"].enhance([yarn_installer, 'webpacker:compile'])
```

> Note: If you are patching an existing system, and you are already on Rails 5.1 or newer you can simplify the above to a single line: `Rake::Task["assets:precompile"].enhance(['yarn:install', 'webpacker:compile'])`

The above should be added to the hyperstack-rails configuration script (if webpack is being installed.)

Because there might be unknown side effects to this, this should be done as a patch (i.e. like the above) rather than sticking it a rake file in the hyperstack-rails lib directory for example.

https://github.com/rails/webpacker/issues/2237 has been raised on the rails webpacker gem. Hopefully the Rails team can accept this reversal in ordering, in which case the whole problem goes away.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.