stefanocudini / leaflet-layerJSON

Build dynamic JSON Layer via Ajax/JSONP with caching
https://opengeo.tech/maps/leaflet-layerjson/
MIT License
92 stars 28 forks source link

Add "main" block to manage dependencies when only using NPM #6

Closed ThomasG77 closed 9 years ago

ThomasG77 commented 9 years ago

At the moment, doing an npm install leaflet-layerjson and making a require('leaflet-layerjson') within a file static/js/app.js (not at project root level), I get an error when using Browserify.

I do :

browserify static/js/app.js > static/js/bundle.js

And I get below error

Error: Cannot find module 'leaflet-layerjson' from '/home/thomas/git/leaflet_browserify/static/js'

I could always make a require like require('leaflet-layerjson/dist/leaflet-layerjson.min.js'); in my app.js file to solve but I think it's more clean to declare "main" block within package.json