heroiclabs / nakama-js

JavaScript client for Nakama server written in TypeScript.
https://heroiclabs.com/docs/nakama/client-libraries/javascript/
Apache License 2.0
182 stars 54 forks source link

Fix XMLHttpRequest for Node Runtime #150

Closed dragonlobster closed 1 year ago

dragonlobster commented 1 year ago

If using this JS SDK without the browser, XMLHttpRequest won't exist - therefore this error occurs:

const descriptor = Object.getOwnPropertyDescriptor(XMLHttpRequest.prototype, "withCredentials");
                                                     ^
ReferenceError: XMLHttpRequest is not defined

In order to fix this we should check if XMLHttpRequest exists first before.

CLAassistant commented 1 year ago

CLA assistant check
All committers have signed the CLA.