43081j / ecosystem-cleanup

A place to keep track of ongoing efforts to clean up the JS ecosystem
292 stars 1 forks source link

replace axios with a fetch based api reimplementation #63

Open dominikg opened 5 days ago

dominikg commented 5 days ago

redaxios https://github.com/developit/redaxios is pretty well known but not that active

https://github.com/developit/redaxios/issues/97 mentions https://github.com/divyam234/feaxios which has recent activity also seems to implement more features.

Would save 2MB install size and 80% bundle size (10kb -> 2kb)

50M downloads/week with 140k dependents: https://www.npmjs.com/package/axios

dominikg commented 5 days ago

This is a critical package/dependency too as it handles request/response, so could have access to all data of applications. Trust/track-record for the maintainer/org of the replacement package should be taken into account as well.

43081j commented 5 days ago

i feel like most usages of axois could just use fetch

i'd be interested in the use cases where fetch isn't quite enough, if we can find some examples

also agreed we should take care to find a trusted, well maintained alternative

dominikg commented 5 days ago

axios has a larger api and utilitity functions. a small drop-in replacement is a much easier sell than refactoring large codebases to remove all uses. I do agree that one should look at how axios is used and if it could be replaced by fetch directly without much effort.

suhaotian commented 2 days ago

What you think about this one https://github.com/suhaotian/xior

dominikg commented 2 days ago

it doesn't seem to be 100% api compatible to axios: https://github.com/suhaotian/xior?tab=readme-ov-file#1-is-xior-100-compatiable-with-axios so it would not be usable as a drop-in replacement.

suhaotian commented 2 days ago

Yeah, but the xior core features is drop-in replacement.

even the redaxios and feaxios is not 100% compatiable, and have ESM/commonjs issue.

And they don't support nested object in params, if want support then need to use qs package which is already gzip 10kb.