Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node support #17

Open
andrewharvey opened this issue Jun 11, 2021 · 3 comments
Open

Node support #17

andrewharvey opened this issue Jun 11, 2021 · 3 comments

Comments

@andrewharvey
Copy link

RequestException: ReferenceError: XMLHttpRequest is not defined

It looks like this library doesn't support use in node, would be nice to support it.

@PanierAvide
Copy link
Collaborator

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

@andrewharvey
Copy link
Author

Thanks for the tip! For now I decided to directly call the API rather than using this library.

@mogita
Copy link

mogita commented Oct 17, 2023

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;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants