Closed isteel closed 9 months ago
Apologies if this isn't an issue with Lightbox2 as such but I'm raising in case it needs investigating - please delete if inappropriate.
Using rails 7.1 with importmap to load lightbox2 and jquery results in an error when lightbox does:
root.lightbox = factory(root.jQuery);
it produces an error of
Uncaught TypeError: Cannot read properties of undefined (reading 'jQuery')
importmap.rb pin "jquery", to: "https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.js" pin "lightbox2", to: "lightbox2.js"
pin "jquery", to: "https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.js"
pin "lightbox2", to: "lightbox2.js"
application.js import "jquery" import "lightbox2"
import "jquery"
import "lightbox2"
Resolved following change to rails importmaps. Not a Lightbox issue.
Hello @isteel,
I'm getting the same problem. Please, could you share your fix?
Apologies if this isn't an issue with Lightbox2 as such but I'm raising in case it needs investigating - please delete if inappropriate.
Using rails 7.1 with importmap to load lightbox2 and jquery results in an error when lightbox does:
root.lightbox = factory(root.jQuery);
it produces an error of
Uncaught TypeError: Cannot read properties of undefined (reading 'jQuery')
importmap.rb
pin "jquery", to: "https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.js"
pin "lightbox2", to: "lightbox2.js"
application.js
import "jquery"
import "lightbox2"