Closed spence-s closed 2 years ago
I think using undici
https://github.com/nodejs/undici on server and axios
https://github.com/axios/axios with https://github.com/softonic/axios-retry in the browser might be a good approach. This implementation could be done using a wrapper which gets loaded using browser
in pkg to load a different wrapper for the browser (the one with axios). I'm not sure if undici supports retries though, so might need to use something like https://www.npmjs.com/package/p-retry.
We completely dropped superagent and now the package is super lightweight. See the docs, you can use an async or Promise fn in the post-hooks for however you want to capture stuff over HTTP or elsewhere with Pino (e.g. to Sentry/Bugsnag/your server/whatever transport you want)
This is simply just a matter of front end bundle size. superagent is a rather big lib when bundled for front end and takes more than a third of the total size of axe....
Many front end applications are already tied to some form of http lib and if it isn't super agent this could discourage adoption. fetch is likely already polyfilled in most modern applications and/or we could expose an api to allow the user to plug in their own solution.
https://bundlephobia.com/result?p=axe@8.0.0