osm-request
osm-request copied to clipboard
Node support
RequestException: ReferenceError: XMLHttpRequest is not defined
It looks like this library doesn't support use in node, would be nice to support it.
Hello, thanks for this feedback. This is something we can work on. As a temporary solution, you can embed XMLHttpRequest on Node side, like done here : https://framagit.org/Pic4Carto/Pic4Review/-/blob/master/webpack.config.js#L57
Thanks for the tip! For now I decided to directly call the API rather than using this library.
Kind of a late hacky answer, but this worked for me:
- yarn add w3c-xmlhttprequest
- Insert this line before importing
osm-request:
global.XMLHttpRequest = require("w3c-xmlhttprequest").XMLHttpRequest;