-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mapzen.js doesn't load with requirejs #382
Comments
this line seems to assume that _importScript will register Tangram in the global scope: https://github.com/mapzen/mapzen.js/blob/master/src/js/components/tangram.js#L61 but with requirejs it doesn't, I did another example where I load tangram before and put it in the global scope here: http://marianoguerra.github.io/bugs/mapzen-requirejs/standalone-manual-tangram.html |
now I did the standalone.manual.tangram thing and it works during development but on production in firefox (nightly) it fails, it seems to be because of this: tangrams/tangram#252
|
Hi @marianoguerra - thanks for the report. That Tangram issue you pointed to has long been a blocker for bundling Tangram within mapzen.js. But we're now close to being able to import Tangram as a node module and require it in a way that will work with your examples. At the moment, you can load your own versions of leaflet and Tangram - tangrams/tangram-frame currently does this. But keep in mind that if you go this route, Leaflet and Tangram should be considered dependencies of mapzen.js. I believe explicit dependencies can be set in requirejs by using the |
here's a minimal example:
http://marianoguerra.github.io/bugs/mapzen-requirejs/
you can see the code here:
https://github.com/marianoguerra/marianoguerra.github.io/blob/master/bugs/mapzen-requirejs/app.js
looking at the code in mapzen.js you call define(['leaflet'], factory) in line 1236 but leaflet is defined in line 1836 as define(L) (which I think it should be define('leaflet', L))
I tried using mapzen.standalone.min.js instead and loading my leaflet:
https://github.com/marianoguerra/marianoguerra.github.io/blob/master/bugs/mapzen-requirejs/app.standalone.js
but as you can see here, it complains that "ReferenceError: Tangram is not defined":
http://marianoguerra.github.io/bugs/mapzen-requirejs/standalone.html
reading the code, I passed _useTangram: false in options but then it renders a gray map and never request the tiles.
my code was working with leaflet and osm tiles, can I set mapzen tiles url template, api key and attribution directly on leaflet? is there something else I have to do?
The text was updated successfully, but these errors were encountered: