GIScience / Leaflet.Heightgraph

Leaflet plugin to visualize height information and road attributes.
https://giscience.github.io/Leaflet.Heightgraph
MIT License
100 stars 42 forks source link

Error using the source bundle #107

Open nrenner opened 4 years ago

nrenner commented 4 years ago

The unminified Rollup bundle dist/L.Control.Heightgraph.js has the dependencies in global scope. The module wrapper only encloses the plugin itself.

Loading this source bundle directly leads to an error, see http://plnkr.co/edit/SZzWSpopCELzDcgu?preview (see Console):

Uncaught TypeError: Cannot set property top of #<Window> which has only a getter
    at L.Control.Heightgraph.js:3993

Concatenating it with the BRouter-Web dependencies e.g. leads to a conflict with Turf.js, see #101 (comment).

The mininfied bundle dist/L.Control.Heightgraph.min.js works, as it is enclosed in an IIFE (immediately invoked function expression):

!function(){ ... }();

So it would be great if the source bundle could be enclosed in an IIFE as well or the module wrapper moved to the top.

TimMcCauley commented 4 years ago

@nrenner would you be able to raise a PR with this logic?

albfan commented 1 year ago

Hi, I can provide a PR on that.

I found conflicts on top and map() function.

of course, minimized file do not use those names and have no conflicts

nrenner commented 1 year ago

PR is #109, just not merged yet.