unfetch
unfetch copied to clipboard
fix: do not use uninitialised `self`
This should fix snowpack and other loaders that don't expect libraries to do odd things.
Can we please merge this? I'm using webpack and having this issue.
Can someone clarify what the actual issue is here? self
is a browser global and this is a browser module, this should have nothing to do with snowpack or any other tool. global
isn't defined in browser environments (where this code runs), so this PR would break a bunch of (other?) tools.
Perhaps the issue is actually that the browser code is being used under Node? if so that should be fixed by this commit which adds an export map.
closing since I'm fairly certain this is really about the export map, but please feel free to reopen if that fix didn't actually address.
Reopening because I'm using vite to bundle a library and when integrating with a next.js app I'm still seeing the self is not defined error when it tries to make a request on the server.