Open gr2m opened 9 years ago
I really like nets
but had the same problem -- the vast majority of my bundle was just Buffer, which was never even getting used.
If this is intended to be browser-first, it could act a bit more like xhr
by defaulting to a string response and using ArrayBuffer instead of Buffer (in both node + browser). But there are some problems that might come from that... maybe it's better to just keep it as a separate module?
Also, there are some alternatives here which might be good (axios and superagent are both small)
+1
Use the package.json browser
field & refactor the require
statements so that only xhr
is included in browserify bundles.
On the other hand, the user can just do
browserify --exclude buffer code.js > bundle.js
I've a little lib that is a wrapper of a REST API, and we use it both in browser and node. When I build it with browserify, ~90% of the code is Buffer. Can I somehow leave it out of the build, and do the
encoding: undefined
thing, at least for browser usage?