Skip to content
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

Allow loading as an ES6/CommonJS module #14

Open
digitalsadhu opened this issue Oct 20, 2014 · 2 comments
Open

Allow loading as an ES6/CommonJS module #14

digitalsadhu opened this issue Oct 20, 2014 · 2 comments

Comments

@digitalsadhu
Copy link

It looks like L needs to be present on the window object for this plugin to work. Leaflet is now available on npm so you can:
var L = require('leaflet')
Since this exposes no global L object, I'm assuming it won't be possible to use this module without shimming.
Is this correct or am I missing something?

@leplatrem
Copy link
Collaborator

Hi !

To be honest we haven't worked on this at all.

@perliedman did it on Leaflet.GeometryUtil using this piece of code : https://github.com/makinacorpus/Leaflet.GeometryUtil/blob/master/dist/leaflet.geometryutil.js#L1-L17

If you want to contribute this here too, it will be merged with pleasure ! :)

Thanks !

@perliedman
Copy link

Yeah, that's the "UMD wrapper". I think there might be a slightly better version of it these days.

This might be the authoritative source: https://github.com/umdjs/umd/blob/master/returnExports.js

@mabhub mabhub changed the title common js module support Allow loading as an ES6/CommonJS module Jun 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants