diff --git a/app/views/layouts/spotlight/base.html.erb b/app/views/layouts/spotlight/base.html.erb
index d386874b1d..24699e5bc5 100644
--- a/app/views/layouts/spotlight/base.html.erb
+++ b/app/views/layouts/spotlight/base.html.erb
@@ -13,7 +13,15 @@
<% else %>
<%= stylesheet_link_tag "application" %>
<% end %>
- <%= javascript_include_tag "application" %>
+ <% if defined? Importmap %>
+
+ <%= javascript_importmap_tags %>
+ <% else %>
+ <%= javascript_include_tag "application", "data-turbo-track": "reload", defer: true %>
+ <% end %>
<%= csrf_meta_tags %>
<%= content_for(:head) %>
<%= description %>
diff --git a/lib/generators/spotlight/install_generator.rb b/lib/generators/spotlight/install_generator.rb
index 818ece397a..dc0dccce94 100644
--- a/lib/generators/spotlight/install_generator.rb
+++ b/lib/generators/spotlight/install_generator.rb
@@ -11,11 +11,17 @@ class Install < Rails::Generators::Base
class_option :mailer_default_url_host, type: :string, default: '' # e.g. localhost:3000
def add_manifest
- append_to_file 'app/assets/javascripts/application.js', "\n//= require_tree .\n"
append_to_file 'app/assets/config/manifest.js', "\n//= link spotlight/manifest.js"
- # Rails installed importmap by default, but we don't have importmap + Blacklight 7 working yet.
- remove_file 'app/javascript/application.js'
+ if Blacklight.version.to_i > 7
+ append_to_file 'app/javascripts/application.js', "\nimport Spotlight from \"spotlight\"\n"
+ else
+ append_to_file 'app/assets/javascripts/application.js', "\n//= require_tree .\n"
+
+ # Rails installed importmap by default, but Blacklight 7 doesn't support importmap.
+ # We must remove the importmap entrypoint or Sprockets will have a double link error with two files named application.js
+ remove_file 'app/javascript/application.js'
+ end
end
def inject_spotlight_routes
diff --git a/spec/test_app_templates/lib/generators/test_app_generator.rb b/spec/test_app_templates/lib/generators/test_app_generator.rb
index 10589f5bab..6059ba6765 100644
--- a/spec/test_app_templates/lib/generators/test_app_generator.rb
+++ b/spec/test_app_templates/lib/generators/test_app_generator.rb
@@ -10,7 +10,7 @@ def use_capybara3
end
def add_gems
- gem 'blacklight', ENV['BLACKLIGHT_VERSION'] || '~> 7.17' unless Bundler.locked_gems.dependencies.key? 'blacklight'
+ gem 'blacklight', ENV['BLACKLIGHT_VERSION'] || '~> 8.4' unless Bundler.locked_gems.dependencies.key? 'blacklight'
gem 'blacklight-gallery', '~> 4.5' unless Bundler.locked_gems.dependencies.key? 'blacklight-gallery'
unless Bundler.locked_gems.dependencies.key? 'bootstrap_form'