chrisveness / geodesy

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

Can't resolve module for react-native Android app #66

Open DiefBell opened 4 years ago

DiefBell commented 4 years ago

We're using Geodesy in a React-Native Android app and are trying to upgrade from 1.1.3 to 2.2.0, however when trying to build and run we get the following error:

While trying to resolve module geodesy from file redux\NMEA.js, the package node_modules\geodesy\package.json was successfully found. However, this package itself specifies a main module field that could not be resolved (\node_modules\geodesy\index). Indeed, none of these files exist:

  • node_modules\geodesy\index(.native||.android.js|.native.js|.js|.android.json|.native.json|.json)
  • node_modules\geodesy\index\index(.native||.android.js|.native.js|.js|.android.json|.native.json|.json)

We've got esm installed and updated to Geodesy 2.2.0 with the npm command from the readme. React-native is version 0.52.1.

Any help on this would be massively appreciated, thanks :)

chrisveness commented 4 years ago

I'm afraid I'm neither a React user nor an Android developer.

That message seems quite strange: package.json doesn't specify any main file, as the library has no single entry point – is React Native (or Redux) somehow injecting a main field, or something?

Unless you require functionality not available in 1.1.3, the simplest might be to stick with that!

DiefBell commented 4 years ago

Unfortunately we need the functionality for forcing UTM zones. I'll keep looking around and try to work out the issue

chrisveness commented 4 years ago

It might be worth reaching out on Reactiflux if you haven't already. Or possibly redux.

Failing anything else, I might be able to backport the UTM zone override to a v1.1.4, but I'd sooner not revisit version 1!

DiefBell commented 4 years ago

Our app currently uses DenisCarriere's TypeScript definitions from a few years back so I suspect that that's what's causing the issue. I've reached out to him in his original ticket from 2016, but if not a backport would be massively appreciated!