Roots Discourse

EventSource polyfill for IE11 gremlins

Howdy friends

Trying to run webpack on IE11 (yes it’s completely sadomasochistic). Need to implement a polyfill for a feature IE11 doesn’t support called EventSource. Here’s the error:

webpack-hot-middleware's client requires EventSource to work. You should include a polyfill if you want to support this browser: https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events#Tools

And here is the most likely polyfill.

But I’m not sure how to implement in the build scripts :frowning: Though here is an example that references the above polyfill at the end of discussion of a slightly different polyfill.

Internet Explorer. Fake browser.

1 Like

I think I’d use https://github.com/remy/polyfills and just call require('polyfills/EventSource') as early as you can in your main.js

I just use polyfill.io, ezpz

2 Likes

It actually needed to be in Webpack and not the main.js of the website. I needed to polyfill Webpack so that when I opened up the http://localtoast:3000 URL in IE11 I wasn’t get JS errors in Webpack. In the end I gave up and went old school manual save + reload baloney.

Hi there,

I’m experiencing the same problem with Edge. Ugghh. This is giving me much headache. Did you get it fixed? Did you figure out how to add it to web-pack?

Please help !!! :smiley: