modules, globals, and plugins
See original GitHub issueIt looks like 0.8 will not expose a global if a module system (i.e. Node or AMD) is present. This is definitely a good thing, but it will make it a bit trickier to integrate Leaflet plugins that don’t have a UMD wrapper. Without the global, said plugins will not have anything to attach to (even when using e.g. a RequireJS shim config).
What do you think about recommending (but not requiring) that all Leaflet plugins have a UMD wrapper? Proj4leaflet and Leaflet.zoomslider could be good base examples.
The two concrete steps I have in mind are:
- Update the plugin authoring guide to (briefly) discuss the two main module systems and recommend adding a UMD wrapper for compatibility with both
- Update all of the “official” plugins (in @Leaflet) to have UMD wrappers
I am willing to take action on these as I have time, but thought it would be good to start by determining an overall strategy.
(I should note that I personally avoid compatibility issues by manually adding AMD wrappers to every third party library I work with that doesn’t have one. Needless to say that isn’t a very scalable approach.)
Issue Analytics
- State:
- Created 10 years ago
- Comments:14 (11 by maintainers)

Top Related StackOverflow Question
With ES modules being around the corner to be shipped to browsers, would it make sense to reconsider?
@tmcw Maybe I wasn’t specific enough (non-native english), I didn’t want to say ALL major browsers but SOME, although 44% seems a lot to me. Also take a count for react/vue user base that use babel. My point was that this is happening, I know that it is not going to be used by all leaflet users right now, but I think it is important to be noted. It was just an “update” comment to emphasize that
modulesupport is imminent.