Using leaflet-draw with browserify
Install leaflet and leaflet-draw with npm
First, install the modules from npm:
npm i --save leaflet leaflet-draw
Create map.js file
Require the leaflet modules
And here's the trick. You have to require the leaflet-draw module without assigning it to a variable. This adds it to the global scope, and modifies the
L object to add the drawing-specific methods.
var L = require('leaflet'); require('leaflet-draw');
For more about Leaflet and browserify, check out this article: Basics of making maps with leaflet.js & browserify.