-
-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
window.L not set if using a module system #5489
Comments
Hi, FWIW, many developers that I see asking questions (SO, GIS SE…) and using build tools (not so many people in the end, to be honest) indeed seem to expect Here is an interesting post that does propose a workaround to expose globally even through the UMD wrapper (it also cites the d3 example BTW). As a side note, I think it could be interesting to provide a simple ES module entry file for power users actually using an ES module loader and expecting their build tool to optimize the bundle (I guess that it is what is implied in that comment). Here is a quick example in SystemJS. And with a simple plugin wrapped with a new As previously, even that example demonstrates that the biggest drawback is breaking plugins that do not adapt to the new pattern… But at least this is just an extra option that is cheap to add (e.g. d3 index file). |
@ghybs I read your post above in detail first now. I haven't read carefully enough to get all the details, but I think this sounds very good. Is this something you think you could make a PR of, so that we have something more to discuss around going forward? It seems we need to come up with a plan on how to move forward with ES6 modules, plugins and bundlers. |
Hi, Sure let me set up something simple. I feel we could get a lot of inspiration from d3 build process. |
With the new Rollup build, the UMD loader will not set
window.L
if you're using a module system, like when building with Browserify.This is a breaking change, and breaks a number of plugins, which rely on
window.L
being set instead of explicitly importing or requiring Leaflet.Related discussion in #2364, where the conclusion was that 1.0 (or 0.8 as it was back then) should set
window.L
.The text was updated successfully, but these errors were encountered: