You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This produces many of the same functions in the final javascript. Treeshaking (I'm using Rollup) is not possible as these are seen as different code paths.
Using static imports:
import PhotoSwipeLightbox from 'photoswipe/lightbox';
import PhotoSwipe from 'photoswipe';
Gives an even larger size of ~250k (unminified). This is also not treeshakable.
The documentation says:
Lightbox (photoswipe-lightbox.esm.js) - loads Core and chooses when PhotoSwipe should be opened. Its file size is significantly smaller. It also loads the first image (in parallel with Core).
So do I have to import core again and pass a separate PhotoSwap to the lightbox? Am I missing something?
The text was updated successfully, but these errors were encountered:
The Lightbox inherits only a small fraction of the Core. It's mainly used to start loading the first image in parallel with the Core JS.
The script is intentionally split into two parts, so you can preload a large part of it separately and/or on-demand when a user actually needs the viewer.
The Lightbox inherits only a small fraction of the Core. It's mainly used to start loading the first image in parallel with the Core JS.
The script is intentionally split into two parts, so you can preload a large part of it separately and/or on-demand when a user actually needs the viewer.
If there's any demo or documentation available, I'm interested in utilizing it.
Never mind, I didn't realize I was already handling it myself.
It appears that
photoswipe.esm.js
andphotoswipe-lightbox.esm.js
modules have a lot of the same code. So when I import them as suggested in the docs:This produces many of the same functions in the final javascript. Treeshaking (I'm using Rollup) is not possible as these are seen as different code paths.
Using static imports:
Gives an even larger size of ~250k (unminified). This is also not treeshakable.
The documentation says:
So do I have to import core again and pass a separate PhotoSwap to the lightbox? Am I missing something?
The text was updated successfully, but these errors were encountered: