lib/importmap/engine.rb in importmap-rails-0.8.1 vs lib/importmap/engine.rb in importmap-rails-0.8.2
- old
+ new
@@ -5,10 +5,11 @@
module Importmap
class Engine < ::Rails::Engine
config.importmap = ActiveSupport::OrderedOptions.new
config.importmap.sweep_cache = Rails.env.development? || Rails.env.test?
+ config.importmap.rescuable_asset_errors = []
config.autoload_once_paths = %W( #{root}/app/helpers )
initializer "importmap" do |app|
app.importmap = Importmap::Map.new.draw("config/importmap.rb")
@@ -45,9 +46,15 @@
end
initializer "importmap.helpers" do
ActiveSupport.on_load(:action_controller_base) do
helper Importmap::ImportmapTagsHelper
+ end
+ end
+
+ initializer 'importmap.rescuable_asset_errors' do |app|
+ if defined?(Sprockets::Rails)
+ app.config.importmap.rescuable_asset_errors << Sprockets::Rails::Helper::AssetNotFound
end
end
end
end