Skip to content
This repository has been archived by the owner on Apr 8, 2020. It is now read-only.

Add EventSource polyfill so that webpack HMR can work on IE/Edge #365

Closed
SteveSandersonMS opened this issue Oct 6, 2016 · 8 comments
Closed

Comments

@SteveSandersonMS
Copy link
Member

Currently, HMR fails on IE/Edge because http://caniuse.com/#feat=eventsource

@MarkPieszak
Copy link
Contributor

Is this something new they implemented? Thought it always worked with IE!

@jongalloway
Copy link

jongalloway commented Oct 6, 2016

EventSource doesn't work in IE, and is still just in "Under Consideration" status for Edge.

I've looked at this a bit before, I think this might be the most popular polyfill - it's been maintained for 4+ years and supports a lot of browsers, including IE11 and Edge.

@SteveSandersonMS
Copy link
Member Author

Thanks @jongalloway - have added that one and it works.

SteveSandersonMS added a commit that referenced this issue Oct 10, 2016
…siderable majority of aspnet-webpack users)
@JohnGalt1717
Copy link

I'm confused. I just downloaded the template pack and started it up in IE and Edge and neither have the event-source polyfill added by default. I added it to the webpack.config.vendor.js manually and there's no difference.

@antmdvs
Copy link

antmdvs commented Nov 1, 2016

and neither have the event-source polyfill

How do you know this? Are you seeing this message in the browser's console when you refresh your page?

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

@JohnGalt1717
Copy link

Yes I'm seeing the message in the browser console in both Edge and IE.

Yes I should include a polyfill. Actually a Microsoft development effort should include the polyfill by default because you know YOUR browsers don't work without it and telling people to use GOOGLE'S browser in a Microsoft development environment is STUPID on Microsoft's part because it ensures that developers don't need your tools at all and thus have no reason to develop on Windows or use Visual Studio. But I digress...

As I noted I added the npm for eventsource-polyfill from the page you noted and then put it in the webpack.vendor.config.js file in the vendors section. It doesn't complain but after rebuilding the webpack file and running it again, there is no difference at all and the error message still shows up in the console for both IE and Edge.

So yes, your templates should have this and any other polyfills for IE 11+ development installed automatically. (or at the very least give a options box when you create the template) Further if you're going to instruct someone to "include a polyfill" it might be helpful to tell them HOW to do so given the complexity of how this project is setup versus instructional materials on webpack's site, and even MVC.net etc.

@SteveSandersonMS
Copy link
Member Author

SteveSandersonMS commented Nov 1, 2016

The latest template does include the event-source polyfill - it's just not published to the VS gallery yet.

If you want to run the latest template, please use the Yeoman generator (npm install -g yo generator-aspnetcore-spa then run yo aspnetcore-spa).

@dkent600
Copy link

@SteveSandersonMS I am using the latest template (for Aurelia) and it does not include a dependency on the eventsource-polyfill.

.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants