diff --git a/lib/lookbook/engine.rb b/lib/lookbook/engine.rb index 354fe4ce..e0f5b374 100644 --- a/lib/lookbook/engine.rb +++ b/lib/lookbook/engine.rb @@ -14,11 +14,11 @@ class Engine < Rails::Engine ) end - initializer "lookbook.set_autoload_paths" do + initializer "lookbook.set_autoload_paths", before: :set_autoload_paths do |app| if opts.autoload_previews && opts.preview_paths.any? - paths_to_add = opts.preview_paths - ActiveSupport::Dependencies.autoload_paths + paths_to_add = opts.preview_paths - app.config.autoload_paths filtered_paths = paths_to_add.filter { |p| !Engine.component_paths.include?(p) } - ActiveSupport::Dependencies.autoload_paths.concat(filtered_paths) if filtered_paths.any? + app.config.autoload_paths.concat(filtered_paths) if filtered_paths.any? end end