From a072362940d2e9f1f5147d4cc409c75596749ac1 Mon Sep 17 00:00:00 2001 From: Keenan Brock Date: Tue, 5 Dec 2023 19:27:11 -0500 Subject: [PATCH] Support non-webpacker environments (#582) Webpacker can be defined, but not configured. In this case, treating it like webpacker is not present ``` lib/mini_profiler_rails/railtie_methods.rb:55:in `get_webpacker_assets_path': undefined method `config' for Webpacker:Module (NoMethodError) Did you mean? concerning from lib/mini_profiler_rails/railtie.rb:33:in `initialize!' ``` solution: ensure the full chain is available --- lib/mini_profiler_rails/railtie_methods.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mini_profiler_rails/railtie_methods.rb b/lib/mini_profiler_rails/railtie_methods.rb index 56889f78..77c09c48 100644 --- a/lib/mini_profiler_rails/railtie_methods.rb +++ b/lib/mini_profiler_rails/railtie_methods.rb @@ -52,7 +52,7 @@ def should_move?(child, node) end def get_webpacker_assets_path - if defined?(Webpacker) && Webpacker.config.config_path.exist? + if defined?(Webpacker) && Webpacker.try(:config)&.config_path&.exist? Webpacker.config.public_output_path.to_s.gsub(Webpacker.config.public_path.to_s, "") end end