Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

If exists, automatically load `application.js` on the storefront (#12691)

Damian Kaczmarczyk42e83a020ab9
diff --git a/storefront/app/views/spree/shared/_head.html.erb b/storefront/app/views/spree/shared/_head.html.erb
index 37a1a55146..8869cbc352 100644
--- a/storefront/app/views/spree/shared/_head.html.erb
+++ b/storefront/app/views/spree/shared/_head.html.erb
@@ -14,7 +14,11 @@
<%= render 'spree/shared/css_variables' %>
<%= render 'spree/shared/fonts' %>
-<%= javascript_importmap_tags 'application-spree-storefront' %>
+<%= javascript_importmap_tags "application-spree-storefront" %>
+<% if Rails.application.importmap.packages["application"].present? %>
+ <%= javascript_import_module_tag "application" %>
+<% end %>
+
<%= javascript_tag "wishedVariantIds = #{(current_wishlist&.variant_ids&.map(&:to_s) || []).to_json.html_safe};" %>
<%= stylesheet_link_tag "tailwind", defer: true, data: { turbo_track: 'reload' } %>