what3words / w3w-node-wrapper

Node wrapper for the What3Words API
https://docs.what3words.com/api/v3/
MIT License
44 stars 10 forks source link

Peer dependencies #44

Closed drjonnicholson closed 2 years ago

drjonnicholson commented 2 years ago

Hi,

We have builds failing due to the library wanting both Axios and CrossFetch installed

Should there be some optionality in the package peer deps meta?

"peerDependenciesMeta": {
  "axios": {
    "optional": true
  },
  "cross-fetch": {
    "optional": true
  }
}
c5haw commented 2 years ago

Hi @drjonnicholson

The @what3words/api provides two built-in Transports which are both optional and you can specify either depending on your environment. If you are running the code in a browser environment and wish to use a built-in transport I would recommend using the fetch transport which uses the peerDependency cross-fetch. In node based environment you can use either cross-fetch or axios, but you must install the peer dependency yourself.

Please look at the Transport Documentation as this is documented there on how to use Transports (as well as using your own Custom Transport for executing requests to our API).

Thanks.