diff --git a/package.json b/package.json index 07d8a37..5e019dc 100644 --- a/package.json +++ b/package.json @@ -26,9 +26,7 @@ "xmlhttprequest": "^1.8.0" }, "browser": { - "xmlhttprequest": false, - "./src/lib/XMLHttpRequest.js": "./src/lib/XMLHttpRequest-browser.js", - "./lib/lib/XMLHttpRequest.js": "./lib/lib/XMLHttpRequest-browser.js" + "xmlhttprequest": false }, "jest": { "coverageDirectory": "./coverage/", diff --git a/src/index.js b/src/index.js index a82fd09..5f44747 100644 --- a/src/index.js +++ b/src/index.js @@ -2,7 +2,7 @@ var BASE58 = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz' var base58 = require('base-x-bytearray')(BASE58) var hex = require('base-x-bytearray')('0123456789abcdef') -const XMLHttpRequest = require('./lib/XMLHttpRequest') +const XMLHttpRequest = window.XMLHttpRequest || require('xmlhttprequest').XMLHttpRequest const getAttributesData = '0x446d5aa4000000000000000000000000' function http (opts, callback) { @@ -84,4 +84,4 @@ function UportLite (opts = {}) { return getAttributes } -module.exports = UportLite \ No newline at end of file +module.exports = UportLite diff --git a/src/lib/XMLHttpRequest-browser.js b/src/lib/XMLHttpRequest-browser.js deleted file mode 100644 index 69453cc..0000000 --- a/src/lib/XMLHttpRequest-browser.js +++ /dev/null @@ -1,3 +0,0 @@ -const XMLHttpRequest = window.XMLHttpRequest; // eslint-disable-line - -module.exports = XMLHttpRequest; diff --git a/src/lib/XMLHttpRequest.js b/src/lib/XMLHttpRequest.js deleted file mode 100644 index ba406dd..0000000 --- a/src/lib/XMLHttpRequest.js +++ /dev/null @@ -1,3 +0,0 @@ -const XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest; - -module.exports = XMLHttpRequest;