matthew-andrews / isomorphic-fetch

Isomorphic WHATWG Fetch API, for Node & Browserify
MIT License
6.95k stars 289 forks source link

Runtime instead of compile time switch #124

Closed danielvanmil closed 3 years ago

danielvanmil commented 7 years ago

Hello,

I'm trying to create one API bundle with browserify that works within node env as well as browser env. This should be not too complex? I was planning to use the fetch API to simplify stuff.

I noticed this project decides compile time whether to use a node/browserify or other implementation to tune some small things. Is it possible to decide this runtime to make it possible to really create one (UMD) bundle to use on node and browser invironments or does this look like a stupid idea?

Thanks,

Daniel.

matthew-andrews commented 7 years ago

I would be worried about combining the server side and client side code in client side bundles. (Which would make the JavaScript bigger and the web page slower). I'm also not sure how this might be useful…