xiaolin / react-image-gallery

React carousel image gallery component with thumbnail support 🖼
http://linxtion.com/demo/react-image-gallery
MIT License
3.77k stars 710 forks source link

Create ESM bundle for ESM related projects (Astro, Svelte, Vite, and newer version of Next.js) #801

Open xiaolin opened 3 weeks ago

xiaolin commented 3 weeks ago

Describe the bug\ The current webpack bundle only builds UMD which is causing issues with projects in ESM environment.

Image Gallery Version\ What version of react-image-gallery are you using?

To Reproduce\ Steps to reproduce the behavior:

  1. Create a project using Astro
  2. Import this library
  3. It breaks

Expected behavior\ It should work with ESM projects

xiaolin commented 3 weeks ago

Current workaround for ESM projects is to do the below.

import Gallery from 'react-image-gallery';
const ImageGallery = Gallery.default ? Gallery.default : Gallery;