Sorbet cannot find Rails as constant inside of a new engine

46 Views Asked by At

New to sorbet, I am trying to enable it for a rails engine inside of a monolith.

cd ./new_engine
bundle install
bin/tapioca gems
# I have also tried bin/tapioca init, same result

It is having trouble resolving Rails in an engine file:

Requiring all gems to prepare for compiling... /Users/my.user/workspace/monolith/new_engine/lib/wp/cms/integration/engine.rb:6:in `<module:Integration>': uninitialized constant Rails (NameError)

The engine file is pretty straightforward:

module Wp
  module Cms
    module Integration
      class Engine < ::Rails::Engine
        isolate_namespace Wp::Cms::Integration
      end
    end
  end
end

Why might sorbet be unable to resolve a Rails constant?

Things I've tried:

  • Lock all gem versions to match monolith
  • Delete and recreate sorbet folder
  • Try both tapioca init and tapioca gems
  • use sorbet from the parent monolith instead
0

There are 0 best solutions below