kirillplatonov / hotwire-livereload

Live reload gem for Hotwire Rails apps.
MIT License
483 stars 28 forks source link

Probrem with zeitwerk #26

Closed alec-c4 closed 2 years ago

alec-c4 commented 2 years ago
Loading application environment...
Loading code in search of Active Record models...
rails aborted!
Loading models failed!
Error occurred while loading application: expected file /Users/alec/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/hotwire-livereload-1.2.0/app/channels/hotwire/livereload/reload_channel.rb to define constant Hotwire::Livereload::ReloadChannel, but didn't

      raise Zeitwerk::NameError.new("expected file #{file} to define constant #{cpath}, but didn't", cref.last)
      ^^^^^ (Zeitwerk::NameError)

Caused by:
Zeitwerk::NameError: expected file /Users/alec/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/hotwire-livereload-1.2.0/app/channels/hotwire/livereload/reload_channel.rb to define constant Hotwire::Livereload::ReloadChannel, but didn't

      raise Zeitwerk::NameError.new("expected file #{file} to define constant #{cpath}, but didn't", cref.last)
      ^^^^^

Tasks: TOP => erd => erd:generate => erd:load_models
(See full trace by running task with --trace)

Hi, looks like a problem with zeitwerk. To reproduce - just create an app with template https://github.com/alec-c4/ks-rails-bootstrap then run bundle exec rails g erd:install and bundle exec rails db:migrate.

kirillplatonov commented 2 years ago

Hey,

This problem seems to be caused by a return statement at the beginning of reload_channel.rb: link. I suppose we could just remove it.

alec-c4 commented 2 years ago

Thanks :)

kirillplatonov commented 2 years ago

Published v1.2.1 with a fix.