Leaflet.Heightgraph icon indicating copy to clipboard operation
Leaflet.Heightgraph copied to clipboard

Error using the source bundle

Open nrenner opened this issue 4 years ago • 3 comments

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.

nrenner avatar Nov 01 '20 09:11 nrenner

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

TimMcCauley avatar Nov 01 '20 09:11 TimMcCauley

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

albfan avatar Nov 25 '22 11:11 albfan

PR is #109, just not merged yet.

nrenner avatar Nov 25 '22 11:11 nrenner