Closed emiax closed 4 years ago
Merged this in with https://github.com/haganbmj/obs-websocket-js/commit/5521364a8dc68c5638817b68cb24dd8797208665 after rebasing. Didn't want to push to yours as it looked like you had tagged a release for your own use. Did some cursory checks in browser and didn't see any issues. I'll tag a release in a little bit.
Sorry for the delay. I lost interest in the project a year ago and it's fallen into a bit of disarray.
v4.0.0 is available in npm and bower now.
Have a look at https://github.com/haganbmj/obs-websocket-js/pull/171 as well as it deals with exporting for commonjs too.
Hi,
We are considering using
obs-websocket-js
as a npm package in a browser-based application. Currently, it seems that the recommended way to import theobs-websocket-js
package into a web application is to refer to the pre-built js bundle from a html file. Instead, we would like to be able toimport 'obs-websocket-js'
, and do the bundling ourselves using Webpack.import 'obs-websocket-js'
currently results inws
being used instead of the built-in browserWebSocket
implementation, so this fails in browsers. To fix this, we suggest using theisomorphic-ws
, package which usesws
in node andglobal.WebSocket
in browsers.If we do this, we can also remove the Webpack
externals
configuration that replacesws
withWebSocket
and rely onisomorphic-ws
to do that for us.I think these changes would keep both the NodeJS and pre-built browser bundle use cases intact, but there may be some use case that I have not thought of? Please let me know your thoughs, and thanks for providing this as an open source library.
Best, Emil