Closed mariosant closed 6 years ago
I think a conditional would be better. That way we won't bundle the whole url
lib in the browser, and when we target Node.js 10, we can remove the require
.
More like that, @sindresorhus ?
No, Node.js 10 also has the URL global, so the conditional should be whether the URL
global already exists.
const URLParser = typeof URL === 'undefined' ? require('url').URL : URL;
Gotcha! I believe this does the trick @sindresorhus.
Looks good :)
This should fix #60.
Unfortunately, I haven't found a way to test it under browser environment. Any help would be appreciated.