Meteor and Leaflet loading issues

I have tried three different packages to try and get leaflet to always work with additional plugins and done of them are quite right. I think this is a simple race-condition thing but often the markers/tiles load incorrectly and I cannot work out why. I have tried all of this in the onrendered helper, two of the packages check to see if leaflet has loaded. Has anyone managed to get it so that there are never any issues?

Hi, I do not understand what you say , because I’m not good at English . But I have a small project with leaflet , you try it…

plugins are a pain since they go on the exposed L object. I wrote a package awhile back & it works good nuff for my needs with leaflet, but the “right” way to do plugins would mean using fs to recursively load all plugins in a folder, which would require npm. Not hard to do if you’re looking to make a PR over the weekend :smile:

Perfect, it was the document on ready I needed. All seems silky smooth. Thanks @nxcong and @mattkrick

Hi Im triying to import a pluging form leaflet(‘leaflet-plugins’) I’ve used the command

 meteor npm install --save leaflet-plugins

As @mattkrick said leaflet plugins are exposed in L object. I tried to import in several variables (for example import lplug from ‘leaflet-plugins’:wink: but always the same error
W20170613-10:15:57.924(2)? (STDERR) Error: Can’t find npm module ‘leaflet-plugins’. Did you forget to call ‘Npm.depends’ in package.js within the ‘modules-runtime’ package?
W20170613-10:15:57.924(2)? (STDERR) at Object._.each.Npm.require (/home/luis/srm/projects/ortosky-web-3.0/.meteor/local/build/programs/server/boot.js:198:17)
W20170613-10:15:57.924(2)? (STDERR) at options.fallback (packages/modules-runtime/modules-runtime.js:21:1)
W20170613-10:15:57.924(2)? (STDERR) at Module.require (packages/modules-runtime/.npm/package/node_modules/install/install.js:88:1)
W20170613-10:15:57.924(2)? (STDERR) at Module.exports.enable.Mp.import (/home/luis/.meteor/packages/modules/.0.7.6.1gjb7av++os+web.browser+web.cordova/npm/node_modules/reify/lib/runtime.js:70:16)
W20170613-10:15:57.924(2)? (STDERR) at meteorInstall.imports.ui.ortoflight.mission.lib.leaflet-mission-manager.jsx (/home/luis/srm/projects/ortosky-web-3.0/.meteor/local/build/programs/server/app/app.js:1749:516)
W20170613-10:15:57.925(2)? (STDERR) at fileEvaluate (packages/modules-runtime/.npm/package/node_modules/install/install.js:153:1)
W20170613-10:15:57.925(2)? (STDERR) at Module.require (packages/modules-runtime/.npm/package/node_modules/install/install.js:82:1)
W20170613-10:15:57.925(2)? (STDERR) at Module.exports.enable.Mp.import (/home/luis/.meteor/packages/modules/.0.7.6.1gjb7av++os+web.browser+web.cordova/npm/node_modules/reify/lib/runtime.js:70:16)
W20170613-10:15:57.925(2)? (STDERR) at meteorInstall.imports.ui.ortoflight.mission.ortoflight-mission-modify-v2.jsx (/home/luis/srm/projects/ortosky-web-3.0/.meteor/local/build/programs/server/app/app.js:4782:1976)
W20170613-10:15:57.925(2)? (STDERR) at fileEvaluate (packages/modules-runtime/.npm/package/node_modules/install/install.js:153:1)