meteor-mapbox
meteor-mapbox copied to clipboard
Meteor 1.3: Can't find variable L
I'm trying to use this package in Meteor 1.3, yet I can't get it to work. Here is the code as I have it now:
Template.map.onRendered(function(){
Mapbox.load({
gl: true
})
this.autorun(function (){
if(Mapbox.loaded()){
L.mapbox.accessToken = 'MY_ACCESS_KEY'
var map = L.mapbox.map('map', 'mapbox://styles/mapbox/outdoors-v9')
}
})
})
Since this package is made for Meteor 1.2, I don't seem to need an import statement for the package in this file since Mapbox
is defined. Yet L
isn't.
Hi @JeroenBe, unfortunately I've stopped Meteor development for a long time and don't have time to support this package anymore. I'll put a warning on the README.
@pauloborges that's to bad. Any reason why you stopped?
The package works just fine for me on Meteor 1.3 I believe that if L is showing as undefined it is because Mapbox is missing.
Do you load it on startup?
Meteor.startup(function() { Mapbox.load(); });
Mapbox GL doesn't use Leaflet (the L
variable). You need to write it like this:
mapboxgl.accessToken = '...';
map = new mapboxgl.Map({
...
});