client-js
client-js copied to clipboard
EventEmitter doesn't exist in browsers
Describe the bug
After playing around with some of my frontend project's package.json dependencies, I ended up yeeting some of the deps that provided node polyfills along the way, and that made this lib no longer work because of this line:
https://github.com/open-rpc/client-js/blob/f1c9b04e74ebe52f3242035483b380170b17e2fa/src/transports/TransportRequestManager.ts#L6
More specifically, when my HTTP Transport is constructed, it would hit this line, and I would get EventEmitter is not a constructor
https://github.com/open-rpc/client-js/blob/f1c9b04e74ebe52f3242035483b380170b17e2fa/src/transports/TransportRequestManager.ts#L24
I had to install events@^3.3.0
to fix it.
Expected behavior
This lib should either depend on events
so that I don't need to require it myself, or it should use APIs that actually exist in the browser.
Nice catch! Thanks for the issue we'll take dive into this.