Lightgallery: Error importing plugins

Created on 24 Jan 2018  路  2Comments  路  Source: sachinchoolur/lightGallery

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.

Most helpful comment

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';

https://github.com/sachinchoolur/lg-zoom.js

All 2 comments

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';

https://github.com/sachinchoolur/lg-zoom.js

Perfect, that was it. Thanks.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ALTELMA picture ALTELMA  路  4Comments

preliot picture preliot  路  3Comments

HamzaAbdullahMoh picture HamzaAbdullahMoh  路  4Comments

shamw4r picture shamw4r  路  5Comments

sourav54321 picture sourav54321  路  6Comments