mpetroff / pannellum

Pannellum is a lightweight, free, and open source panorama viewer for the web.
https://pannellum.org/
MIT License
4.16k stars 711 forks source link

Feature Request: export as modules #1106

Open aendra-rininsland opened 1 year ago

aendra-rininsland commented 1 year ago

Currently this puts everything from src/ on the window object, which means you have to do a bunch of shimming in Webpack et al if you want to use with React or other modern component libraries. If you change your main JS files in src/ to export ESM and then have the build tool attach it to the window object, you'll let users have a lot more control over how this is used in their apps.

I'm using this for a large project for work so I'm inclined to release this as a PR imminently, it's about an hour of work I'd imagine.

mpetroff commented 1 year ago

The code is ES5, and for the time being, I don't want to switch to ES6. I'd be inclined to accept a PR if it doesn't break this compatibility or massively change the current build system, but I'd have to see such a PR before making such a decision.