I've pinned photoswipe:
./bin/importmap pin photoswipe --download
in app/javascript/application.js I've added
import PhotoSwipeLightbox from 'photoswipe'
document.addEventListener("turbo:load", function() {
const lightbox = new PhotoSwipeLightbox({
gallery: '#existing-files',
children: '.gal',
pswpModule: () => import('photoswipe')
});
lightbox.init();
});
The lightbox opens straight away on page load but the image is missing. pswpModule: () => import('photoswipe') doesn't appear to work but no error is given.