Trying to migrate from v1 to v2, I have searched and cant see a migration guide.
The only only instructions for usage is using modules. We dont use modules for anything else but I cant see an alternative so trying to get going using modules but just for LightGallery.
When using modules I get errors: "exports is not defined". After adding "var exports = {};" the next error says require is not defined. When I search to fix require is not defined Google searching says to not use modules and I am going round in circles. Any help is appreciated. Idially "lightgallery" would be defined globally by loading the plugin js file on the server and no modules importing/exporting would be required. I am working on a large old codebase so converting everything to modules is probably out of scope.
Steps to reproduce
Using TypeScript that transpiles into ES6. Not a node live environment.
TS code that you use to initialize lightGallery.
///
import lightGallery from "../3rdparty/lightGallery-v2.7.1/lightgallery.min.js";
import lgFullscreen from "../3rdparty/lightGallery-v2.7.1/plugins/fullscreen/lg-fullscreen.min.js";
import lgVideo from "../3rdparty/lightGallery-v2.7.1/plugins/video/lg-video.min.js";
Managed to get it working.
I updated my tsconfig from no modules to ""module": "ES2015","
Set allowSyntheticDefaultImports to true
Appended "type=module" to the Githubissues.
Githubissues is a development platform for aggregating issues.
Description
Trying to migrate from v1 to v2, I have searched and cant see a migration guide.
The only only instructions for usage is using modules. We dont use modules for anything else but I cant see an alternative so trying to get going using modules but just for LightGallery.
When using modules I get errors: "exports is not defined". After adding "var exports = {};" the next error says require is not defined. When I search to fix require is not defined Google searching says to not use modules and I am going round in circles. Any help is appreciated. Idially "lightgallery" would be defined globally by loading the plugin js file on the server and no modules importing/exporting would be required. I am working on a large old codebase so converting everything to modules is probably out of scope.
Steps to reproduce
Using TypeScript that transpiles into ES6. Not a node live environment.
TS code that you use to initialize lightGallery.
///
import lightGallery from "../3rdparty/lightGallery-v2.7.1/lightgallery.min.js"; import lgFullscreen from "../3rdparty/lightGallery-v2.7.1/plugins/fullscreen/lg-fullscreen.min.js"; import lgVideo from "../3rdparty/lightGallery-v2.7.1/plugins/video/lg-video.min.js";
const options = { plugins: [ lgFullscreen, lgVideo ], selector: '.jsLightbox', ... };
lightGallery(parentNode, {options});
Environment
Additional context