ruby-on-railsrubyreactjsisomorphichyperstack

When upgrading from Hyperloop to Hyperstack, is "opal_hot_reloader" gem still necessary?


I am just upgrading a Rails app from Hyperloop to Hyperstack. Is the "opal_hot_reloader" gem obsolete since Hyperstack?


Solution

  • Yes... a version of the hot-loader is built into hyperstack now.

    In your hyperstack.rb initializer you want:

      Hyperstack.configuration do |config|
        ...
        config.import 'hyperstack/hotloader', client_only: true if Rails.env.development?
      end
    

    The Procfile (for foreman) looks like this:

    web:        bundle exec rails s -b 0.0.0.0
    hot-loader: bundle exec hyperstack-hotloader -p 25222 -d app/hyperstack
    

    assets/javascripts/application.js should end like this:

    //= require jquery
    //= require jquery_ujs
    //= require hyperstack-loader
    

    The hyperstack loader will (using the initializer) figure out what additional code to add to your assets including the hotloader.