Leaflet.label
Leaflet.label copied to clipboard
Update npm with the latest Leaflet.label version (fixes Browserify)
I am including both Leaflet and Leaflet.label through browserify.
But I get this error:
Uncaught TypeError: Cannot set property 'labelVersion' of undefined leaflet.label.js:15
It seems like Leaflet.label is being passed {}
instead of window
variable.
I added some logging dist/leaflet.label.js
:
!function(t){
console.log('L', window.L);
console.log('t', t);
console.log('args', arguments);
console.log('t.L', t.L);
console.log('t === window', t === window);
var e=t.L;e.labelVersion="0.2.2-dev",.....
The console shows the following:
L Object {version: "0.7.2", noConflict: function, Util: Object, extend: function, bind: function…} leaflet.label.js:10
t Object {} leaflet.label.js:11
args [Object, document] leaflet.label.js:12
t.L undefined leaflet.label.js:13
t === window false leaflet.label.js:14
Uncaught TypeError: Cannot set property 'labelVersion' of undefined leaflet.label.js:15
I'm using Leaflet-label here: https://github.com/luqmaan/MetroRappid/commit/d3aa02312b633b75194418cbc45d58dfe505c841
I'm getting this error because the version of Leaflet.label published on npm is out of date.
The npm version (last updated Jul 14 2014) doesn't have the fix from #89 (merged Aug 1 2014).
Can you please update npm with the latest leaflet-label?
Unfortunately I do not own the npm package for leaflet-label. I'll get in contact with the current own and ask if he will transfer it.
:koala:
:+1: Have just ran into this issue myself.
i did as well, can someone publish the package to npm? /cc @pitbeast looks like you have ownership
Any news on this, @PitBeast ?
For the moment you can just install Leaflet.label from GitHub instead of the npm repository with
npm i --save Leaflet/Leaflet.label
then in your javascript
require('leaflet.label');
Seems like always pulling npm modules from github would be a smart choice ...