Skip to content

Commit

Permalink
Support non-webpacker environments (#582)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
kbrock committed Dec 6, 2023
1 parent f88e659 commit a072362
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/mini_profiler_rails/railtie_methods.rb
Expand Up @@ -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
Expand Down

0 comments on commit a072362

Please sign in to comment.