-
-
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
v5-beta - Not clear how to install and import Photoswipe #1763
Comments
You can install the beta like this Then you'll be able to do: import PhotoSwipeLightbox from 'photoswipe/dist/photoswipe-lightbox.esm.js';
const options = {
gallerySelector: '#my-gallery',
pswpModule: 'https://example.com/photoswipe.esm.js'
};
const lightbox = new PhotoSwipeLightbox(options);
lightbox.init(); and import CSS with something like Please note that non-dynamic import of For now, if you use something like webpack - you may create multiple outputs, so your Default pswpModule is located at |
Yes @dimsemenov
Already check to open that absolute URL in the browser and it finds the file... |
It seems the error is added by the webpack when Changing I'm not sure what to do with it yet and how to make bundlers ignore dynamic import (aside from completely disabling the feature). possibly with polyfill https://github.com/GoogleChromeLabs/dynamic-import-polyfill |
Thanks @dimsemenov What should be the correct syntax to import Photoswipe with
All I get is
For now to me it could be ok to completely disabling the feature. Is it just a matter of a little performance worsening? |
should now be fixed by #1764 (comment), so closing. |
@dimsemenov Almost there! There's a Warning while building, check here #1764 (comment) |
@dimsemenov not solved I think. In sveltekit breaks dev right away. |
Hi @dimsemenov , as a premise, thanks for your incredible work! Really.
I work in a classic Webpack environment so I install libraries launching:
npm install swiper
then I import libraries in my
app.js
like:import Swiper, {Navigation} from 'swiper';
and CSS in my
app.scss
like:@import "~swiper/swiper";
getting automatically it from the
node_modules
folder.Note: I can't put an absolute path as show in docs because I install it via npm:
pswpModule: '/v5/photoswipe/photoswipe.esm.js' //<== Can't do something like https://mysite.com/photoswipe.esm.js
If only solution is import all modules at start that's not a problem to me, but I don't understand how to do that.
Any help is really welcome cause I'm currently stuck to use it :(
Thanks
The text was updated successfully, but these errors were encountered: