awolden / brakes

Hystrix compliant Node.js Circuit Breaker Library
MIT License
300 stars 35 forks source link

transpile lib? #101

Open DavideDaniel opened 6 years ago

DavideDaniel commented 6 years ago

Is there a plan to transpile code for supporting browser usage or maybe atleast providing support in some areas? Lots of times node_modules are excluded in webpack settings and code that isn't transpiled (static or =>) end up throwing errors in isomorphic land...

awolden commented 6 years ago

Hi @DavideDaniel, thanks for looking into this and submitting the PR. I looked at transpiling this when it was first made, but the major use case is for server-to-server communication. The library requires high numbers of calls to the same service to determine the health of the downstream server, as such it maintains a lot of long running state. In isomorphic land, steps should be taken to ensure the library doesn't make it into client code by using webpack define or some other method.

With that being said, there might be use-case where a client is making a large number of calls to downstream services, but even then I still wouldn't want to transpile this lib since it will primarily be running on the server and it will make production server logs that much harder to decipher.

DavideDaniel commented 6 years ago

Yep, I agree, this lib should be kept out of client code. The pr isn't necessary as the root problem turned out to be a piece of isomorphic code that was being pulled into client code... there is a use case for restricting extra calls from clients but there are also existing solutions for those, so we can close this unless you see any other reason not to.