Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
[feature] Enable customizing networking library reducing bundle size #113
Fixes #103 .
The core of rest-hooks clocks in at around 7kb gzip. However, there is one part - superagent - which is quite sizable. If someone decides to override their networking library it won't get tree-shaked out due to it being included in the Resource class. This results in what is essentially a doubling of this library's impact on their bundle size.
Splitting out the fetch implementation to a derived class allows those implementing their own fetch solution to not have to import the superagent fetch solution. This means with tree-shaking superagent will never even be included in the bundle.
Will have a follow blog post to talk about bundle sizes to clear things up since bundlephobia is pretty misleading and we have no desire to make the rest-hooks library worse just to rig artificial metrics that have no bearing in real life.