robotty / dank-twitch-irc

Connect to Twitch chat from Node.js
https://www.npmjs.com/package/dank-twitch-irc
MIT License
88 stars 25 forks source link

Non ES2018 support #30

Closed gempir closed 4 years ago

gempir commented 4 years ago

When running dank-twitch-irc in a browser that has no ES2018 support (like Firefox) it will crash because of some regexp issue.

It would be nice if dank-twitch-irc supported most major browsers and recent versions of them.

gempir commented 4 years ago

8896b8be1cc374510dc98c462044ef5b3abbb28e fixed it and it's now in 3.2.6

KaKi87 commented 3 years ago

Hello, How do you run it in browser ? I tried jsdelivr, without success. Thanks

gempir commented 3 years ago

You need to initialize it with websocket configuration option https://github.com/gempir/raftchat/blob/master/src/state/Store.tsx#L19

new ChatClient({
            connection: {
                type: "websocket",
                secure: true,
            }
        })
KaKi87 commented 3 years ago

I mean, ChatClient is undefined in the first place 😅

gempir commented 3 years ago

You need a bundler and then import it.

import { ChatClient } from "dank-twitch-irc";

KaKi87 commented 3 years ago

You mean I can't do it without webpack ? :/

KaKi87 commented 3 years ago

I can't do it in vanilla JS, for a userscript ?

gempir commented 3 years ago

By default this library isn't compatible in that way I think, so no. Needs to be some sort of module thingy not 100% sure, I always use a bundler

RAnders00 commented 3 years ago

Yes, this library wasn't originally meant to run natively in the browser. However with the websocket configuration option you can make it work, if you use a bundler like webpack or parcel.