Oh, I remember this now…
Here’s what I have in one of my plugins README:
If you use Photoswipe in a module template, you must add this to the module’s (not the main modular page) frontmatter:
never_cache_twig: true. You don’t need to do this if your site has caching disabled.If caching is enabled and your Photoswipe gallery is invoked in a module template, all of the assets that make Photoswipe work are omitted from the cache. You will see the gallery unstyled and unscripted and lightbox will not work.
Issue #1: Assets not loading with twig cache enabled has more details.
There’s a link about the problem to Andys old comment