-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added support for pswpModule import without absolute path #1764
Conversation
Thank you. Can you please modify the pull request so it changes source files (from |
No worries :), done and dusted, everything should be good to go. |
thanks, should now be working in 5.0.3 import PhotoSwipeLightbox from 'photoswipe/dist/photoswipe-lightbox.esm.js';
import PhotoSwipe from 'photoswipe/dist/photoswipe.esm.js';
import 'photoswipe/dist/photoswipe.css';
const options = {
gallerySelector: '#my-gallery',
childSelector: 'a',
pswpModule: PhotoSwipe
};
const lightbox = new PhotoSwipeLightbox(options);
lightbox.init();
|
@brunogrcsada @dimsemenov Yes, this works! 🎉 Even if at the build there's this warning
Any way to solve it? |
@dangelion I managed to get the warning myself with a Next.js project. I was using Svelte and it's a breeze, what JS library are you using? The reason for webpack not liking this is because it prefers explicit paths when importing a module; this isn't a big issue but I'll look into it. Adding webpackIgnore to the import fixes this issue: return typeof module === 'string' ? import(/* webpackIgnore: true */ module) : module; I'll push this in a second. |
I've added the suppress comment to my latest pull request :) @dimsemenov @dangelion |
Hi @brunogrcsada thanks, I can't see your latest pr. How can get it? |
@dangelion Here it is, I also added image caption support: #1766 |
Thanks @brunogrcsada now I see it 4944ac8 @dimsemenov When you think you'll release it? |
@dimsemenov Is this solved in the new 5.1.0? |
@ dangelion I don't know whether this answers your question, but I use version 5.1.0 with only relative paths:
This works fine! |
This pull request gives the ability for users to import the pswpModule script without an absolute path; it's extremely useful when PhotoSwipe is saved as a node module. However, it still allows for the absolute path to be given instead...
Example: