Closed TheGreatRefrigerator closed 1 year ago
This breaks the library on Node.js
Hi @nfmshow,
you can either use node 18 (latest LTR) which includes fetch, or you need to stick to the 0.2.0 version. Most of the changes for 0.3.0 were internal except for the optimization support.
If you need the optimization feature you could also install from
git://github.com/GIScience/openrouteservice-js.git@e8bf72315f2f6f7714a34b8a9e5796b48941835e
which should be after the optimization feature but before the fetch implementation.
https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch
That would strip the last dependency and make it a true native JS lib
Probably needs to replace the timeout with an AbortController: https://stackoverflow.com/questions/31061838/how-do-i-cancel-an-http-fetch-request/47250621#47250621
One approach could be https://sevic.dev/notes/timeout-fetch/