meteor-mapbox icon indicating copy to clipboard operation
meteor-mapbox copied to clipboard

Meteor 1.3: Can't find variable L

Open jeroenbe opened this issue 8 years ago • 4 comments

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.

jeroenbe avatar Jun 10 '16 20:06 jeroenbe

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 avatar Jun 12 '16 17:06 pauloborges

@pauloborges that's to bad. Any reason why you stopped?

jeroenbe avatar Jun 12 '16 17:06 jeroenbe

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(); });

guillaume-miara avatar Jun 18 '16 06:06 guillaume-miara

Mapbox GL doesn't use Leaflet (the L variable). You need to write it like this:

mapboxgl.accessToken = '...';
map = new mapboxgl.Map({
...
});

nicooprat avatar Jul 04 '16 14:07 nicooprat