chrisveness / geodesy

Libraries of geodesy functions implemented in JavaScript
http://www.movable-type.co.uk/scripts/geodesy-library.html
MIT License
1.17k stars 202 forks source link

module import failing #23

Closed nerdstep closed 8 years ago

nerdstep commented 8 years ago

Trying to require the module in my project fails due the define statement in latlon-spherical.js, line 444 is trying to defined [Dms] as a dependency which is looking for it as a module in node_modules. I fixed it by removing the value. Not sure it's needed there anyway, as there is a required statement for it at the top of the file.

chrisveness commented 8 years ago

That line was a (probably misguided) attempt to cover off AMD modules as well as Node.js (CommonJS) modules. I've never used AMD modules, and most likely got it wrong! In view of that, I recently removed the AMD module definitions, but haven't yet released a new version. I will put together a new release ASAP.

tomsun commented 8 years ago

Bit me a few days ago trying to bundle the module in a webpack:ed application. No issues when used in a node application though.

Removing the conditionals was good enough for my needs: https://github.com/tomsun/geodesy/commit/821cac0e718f13b00dddfe915955628ff86e98b6

chrisveness commented 8 years ago

@nerdstep: I have released a new version 1.1.0 to npm without AMD module requests.

chrisveness commented 8 years ago

@tomsun: the conditionals are required for use in browsers using <script> tags; roll on ES2015 modules!

gotenxds commented 7 years ago

Hii, I'm having this same problem how can I solve it while using webpack ?