eventsource
eventsource copied to clipboard
util.inherits is not a function
I tried to integrate this lib into my project using ViteJS but error is displayed: Uncaught TypeError: util.inherits is not a function at node_modules/eventsource/lib/eventsource.js
My workaround is to use the EventSourcePolyfill
cosnt es = new window['EventSourcePolyfill']('http://example.com')
Hope this help someone while wait for a fix
@hong-duc how do you populate window with EventSourcePolyfill
?
In general I would recommend you use a browser-oriented polyfill if that is what you need - eg https://github.com/amvtek/EventSource
I don't have a need for it really. I was just curious on how to do it since I would like to use this polyfill.. But because of the bug I've had to resort to using this: https://github.com/Yaffle/EventSource even if it did some political changes..
face the same problem too