I'm using lightGallery in a meteor.js project using ES6 imports, the stand-alone gallery works fine with
import 'lightgallery.js';
import 'lightgallery.js/dist/css/lightgallery.css';
...
lightGallery(document.getElementById('lightgallery'));
As soon as I add a plugin, however:
import 'lightgallery.js';
import 'lg-zoom';
import 'lightgallery.js/dist/css/lightgallery.css';
I get the following errors:
Uncaught TypeError: Cannot read property 'modules' of undefined
at modules.js?hash=25d679623d7a6045380d20504bd46c0895d12def:39787
at modules.js?hash=25d679623d7a6045380d20504bd46c0895d12def:39789
at modules.js?hash=25d679623d7a6045380d20504bd46c0895d12def:39280
at lg-zoom.js
...
lightgallery and plugins were installed with NPM, the error shows up with all plugins - even creating a custom one according to API.
Hey @leoncvlt,
If you are using pure js version of lightGallery lg-zoom.js is the correct module, not lg-zoom.
Please use the below code and let me know the result.
import 'lightgallery.js';
import 'lg-zoom.js';
import 'lightgallery.js/dist/css/lightgallery.css';
Perfect, that was it. Thanks.
Most helpful comment
Hey @leoncvlt,
If you are using pure js version of lightGallery
lg-zoom.jsis the correct module, notlg-zoom.Please use the below code and let me know the result.
https://github.com/sachinchoolur/lg-zoom.js