how to use browserify with esri leaflet

10-14-2015 12:29 PM
Frequent Contributor
1 0 1,449

or (john finally learns why the heck we bother publishing esri leaflet as a package on npm)

as a geographer turned hack web developer, it sometimes feels to me like there's an endless barrage of programming buzzwords going around to try and keep track of.   Angular, React, Ember, Node, Bootstrap, Backbone, Grunt, Gulp, AMD, UMD, ES6, etc. etc. etc.

I probably spend more time trying to figure out what's worth learning (is it already over? is it popular? is it really popular? is it even relevant to me?) than i do actually learning how they work.  all that said, i know some of you may be suffering from framework overload too so consider this the disclaimer 'yes, this is another blog that introduces a buzzword to beginners'.

as long as i'm being honest, i need to get one more thing off my chest. i've been contributing to Esri's open source plugins for leaflet for a long time now and i never really had any idea why we publish them on until recently.  for me browserify is what helped me finally figure it out.

first things first.  what is 'npm'?

npm is a package manager that helps people share JavaScript code.  this video explains what it is and how it works far better than i could

and what is 'Node.js'

i'm going to throw out another one-liner here and punt to an external link for more info, but Node.js is a way of executing javascript code on a web server, as opposed to the place its typically run (the browser).

What is Node.JS and Why Should I Care? [Web Development]

until recently, for me thats where it ended. i thought Node.js and npm were one in the same.  since i'm pretty much a hack, and i don't often find myself writing the backend of websites, i thought there wasn't much i could do with Nodes.js/npm.  and as such, i spent a long time completely clueless as to why we put the code on npm when we published new versions of esri leaflet.

for me, getting familiar with browserify made it all click into place.

if you'd interested in learning more, check out my sample in Esri's Developer Support repository to see browserify in action and play around with it yourself.

developer-support/ at master · Esri/developer-support · GitHub

if you're not, thats okay too!

About the Author
ArcGIS Hub, anything open, JavaScript and baking bread.