I'm using CRA (Create React App) version 2, customized-cra, and mobx, when I try to run simple code, I got an error.
Uncaught (in promise) TypeError: Right-hand side of 'instanceof' is not an object
at normalize (normalize-arguments.js:188)
at got (create.js:37)
Should return html body.
codesandbox: https://codesandbox.io/s/n4q68m36ll
code:
try {
console.log(this.resturl.spinnerList)
const response = await got('sindresorhus.com')
console.log(response.body)
} catch (error) {
console.log(error)
}
TypeError: Right-hand side of 'instanceof' is not an object
at normalize (node_modules/got/source/normalize-arguments.js:137:68)
at got (node_modules/got/source/create.js:32:28)
I ran require('url').URLSearchParams in the sandbox. It gives undefined. On my local machine it works perfectly.
@szmarczak
I'm not running my code in the codesandbox, but also in my local machine too.I just put an example link in order to add a working project example (not just code / screenshot).
So, please reopen this issue.
@oknoorap You're running it through webpack. As metioned in the documentation, Got doesn't support browsers.
@szmarczak okay i see. thank you.
https://github.com/sindresorhus/ky is a good alternative for browsers
@rohmanhm thanks dude..
Most helpful comment
https://github.com/sindresorhus/ky is a good alternative for browsers