I believe what you are running into with the NPM libraries, which look like they are designed to work server-side, is the fact that they are using POST requests to Sumo Logic. Making POST requests from the client side to any domain that didn't originate the actual Javascript is usually prevented by the browser (see Wikipedia for CORS for the gory details).
However, the HTTP Source endpoints also support GET requests. You can configure an HTTP Source as described here: https://help.sumologic.com/Send_Data/Sources/HTTP_Source. Once you have the URL, you can send a log line via Curl:
curl -v https://collectors.sumologic.com/receiver/v1/http/[UniqueHTTPCollectorCode]?[message_data]
(See also the documentation here: https://help.sumologic.com/Send_Data/Sources/HTTP_Source/Upload_Data_to_an_HTTP_Source)
The endpoint supports GET for exactly this reason; you can use this on the client side by making an "image" request, something like this:
var img = new Image();
img.src = 'https://collectors.sumologic.com/receiver/v1/http/[UniqueHTTPCollectorCode]?[message_data]'
You can look for an example that is using this technique to mimick "Google Analytics" with Sumo on Github, look for user oriadam
and repository Sumologic-as-GA
.
You have to hand-roll this at the moment, but please feel free to share your results!