Skip to content

Commit cfff539

Browse files
princejosephclaude
andcommitted
Add Zeitwerk ignore for app/hyperstack/components in railtie
Components are Opal/client-side code compiled by Sprockets and should never be eager-loaded or autoloaded server-side. Without this, apps with eager_load=true (e.g. in CI) fail with NameError because Zeitwerk alphabetically loads component files before HyperComponent is defined. The fix belongs in the railtie so all Hyperstack apps get it automatically rather than requiring a manual workaround in each app's initializer. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 0a16df4 commit cfff539

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

ruby/hyperstack-config/lib/hyperstack/rail_tie.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,14 @@ def auto_config=(on)
8080
config.hyperstack.auto_config = true
8181
end
8282

83+
# Hyperstack components are Opal/client-side code compiled by Sprockets.
84+
# Tell Zeitwerk to ignore them so they are never autoloaded or eager-loaded
85+
# server-side. Without this, CI environments (eager_load=true) alphabetically
86+
# load component files before HyperComponent is defined, causing NameError.
87+
initializer "hyperstack.ignore_client_only_paths" do
88+
Rails.autoloaders.main.ignore(Rails.root.join('app/hyperstack/components'))
89+
end
90+
8391
config.after_initialize do |app|
8492
next unless [:on, 'on', true].include?(config.hyperstack.auto_config)
8593
# possible alternative way

0 commit comments

Comments
 (0)