New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Preact 7 Support for Internet Explorer 11 #453
Comments
Yes! Absolutely. There's no good reason for Preact to drop IE9+ support, it just didn't block the 7.1 release. If you're able to screenshot the stack trace or any other context, that might be useful. Related issue: #430 |
Sure, here is the screenshot: It's a German IE11, the message translates to "out of stack space". IE version 11.576.14393.0, update version 11.0.38; Windows 10. My app uses these packages:
When I get rid of all the redux stuff and just use Preact to render a simple <h1>Hello World</h1>, I get the same error. When I use preact 6.4.0 instead of 7.1.0, the problem goes away. |
Alright, will look into it. It's due to a change in TextNode behavior, which will either be reverted or modified to use non-empty Textnodes. |
@pahund Having trouble reproducing this. Updating to preact 7.1 and running preact-boilerplate seems to work fine in IE (checked in 9 - maybe it's specific to 11?) |
Checked in 11, seems OK too. Ran tests with karma in IE11 too. The only thing I found was #430. |
I have set up a demo project that should let you reproduce the problem: https://github.com/pahund/preact-ie11-bug I suspect it has something to do with the babel-polyfill, which I need for my project so that promises and generators work on IE11 |
Ahhhh yes it will be the Promise polyfill. Interesting. To me that seems like an issue with babel-polyfill. FWIW, I'd recommend using regenerator and promise-polyfill instead of babel-polyfill. Promise-polyfill is a more accurate implementation of Microtasks, and won't trigger the infinite recursion issue. |
A quick test to see if we're on the right track would be: import { options } from 'preact';
options.debounceRendering = f => f(); This will turn off async and bypass the promise usage entirely. |
@developit do you think |
Probably makes sense only for browser which don't support promises, which is IE only. IE is slow anyway. |
It should work well, since it uses |
@NekR another option would be to use setTimeout for IE, a decent compromise: import { options } from 'preact';
options.debounceRendering = setTimeout; |
Maybe makes since to have it default so? Or it's already if promises aren't available? If so, then fix is simply load/require/include promises polyfill after preact. |
The thing is, Here's a benchmark: https://esbench.com/bench/55d4d44e2efbca1100bf7251 |
@developit what I mean is that obviously not everyone uses |
@NekR yep. If Promise isnt available it falls to setTimeout. |
Has there been any progress on this? Asking consumers of our package to all revert from babel-polyfill and use promise-polyfill is a no go for our situation. We're building a shared component that gets dropped into many applications and Preact is perfect as it can keep the shared component size down. We bundle our component using babel but without any polyfills, targeting node and umd keeping preact as an 'external'. So it's up to the consumer how they polyfill. I've tested as a consumer using babel-polyfill and setting
|
@tomatau I think the best course of action here is to cut a The fact that |
This should be fixed in 7.2.0 (beta). Let me know if the recursion issue is still happening! |
I can confirm that the bug is fixed in version 7.2.0 (beta). I added preact 7.2.0 to my the demo project I had setup to show the issue. It works fine now, no more “stack overflow” error in Internet Explorer 11's JavaScript console. Thank you, keep up the good work! |
@developit I'm planning to use the 7.2 release in the coming weeks (just convincing our product owner to let me spike the fix which should be fine). Can you hold off closing this until checking my use case which wasn't solved by the |
@tomatau I closed it 7 days ago, but I totally see your point. Want to open up a new issue specifically for the recursion issue? |
Oh no worries. I'll just open a new issue if it definitely is still an issue :) |
* Adding preactToCustomElement helper function * Self review * more self review * Classlist polyfill * More self review * Attribute values that are set before connected * Simplification * Preact@7.1 didn't work in IE11 so upgrading to 7.2. See preactjs/preact#453 * Fixing IE11 * Small fix to cps-button * Forgot to commit a file
* Adding preactToCustomElement helper function * Self review * more self review * Classlist polyfill * More self review * Attribute values that are set before connected * Simplification * Preact@7.1 didn't work in IE11 so upgrading to 7.2. See preactjs/preact#453 * Fixing IE11 * Small fix to cps-button * Forgot to commit a file * cps-tooltip custom element * Tests and events. * Docs * Polyfilling CustomEvent in IE11 for tests * Fixing when tooltip is too far to the right * Oops forgot to uncomment
I found this issue because this error started firing IE11 users after I tried switching from react to preact. I can't reproduce it locally, but am seeing it in production error logs. Switching to preact 7.2.0 did not seem to fix the problem. I get three variants of it, stacktraces from rollbar below: From
From
From
Apologies if this is a core-js issue, it's hard to parse https://github.com/zloirock/core-js#caveats-when-using-symbol-polyfill and zloirock/core-js#260 (comment). Let me know what I can do to narrow this down. |
Hmm - I would strongly recommend not using the Symbol polyfill. It will cause Preact to use Symbol in IE, which it was not designed to do (it checks for Symbol support and uses a fallback if its not supported). |
@hartshorne It might be worth looking into dropping |
@developit yeah it’s probably a good idea to remove the use of Should @hartshorne or I open a new issue for this? |
Yup, plus it's already falling back to a pretty reasonable default, which is just an obscure string. One thing we'll need to be careful with - there are a few other libraries (mainly I'd be happy to review a PR if you have the time. Right now the Symbol is a constant. I'm okay with that, but really there's no reason we can't just inline it. That might actually speed up property access in V8 👍 . It's only used in 4 places. |
We've worked around this by setting our TypeScript target to ES5 for now. Because this change will affect other libraries, I think it's best to leave it to you to manage it. Thank you! |
Works for me! I think we'll pull Symbol in Preact 8, I'll add it to the list of breaking changes. |
I'm still getting the error for a Webpack UMD bundled preact component that is then bundled into a larger web app. We can get around the problem by using the "var" bundle instead of "umd" for the component but it would be nice for the umd component to work in IE11 without the "out of stack space" issue. |
oh - that's interesting.... maybe you are getting 2 copies of Preact? |
The UMD bundle has Preact configured as an external so there shouldn't be two copies |
Ah ok. In that case where/how is preact loaded? |
oh god, this is such a bad idea, but 😅 it can be done like this |
In case anyone else gets here.. I'm seeing this issue with preact x beta and either |
@shawnwall Can create a new issue with the error you're getting? We're running our test suite against IE11 with each PR that is merged. We're using the same |
@marvinhagemeister sorry for the false alarm. I believe the error is actually related to the code in a component I am using using Portals, etc. I've created a simplified iframe component myself and now things are okay. |
With preact 6.4.0, my medium-sized React application worked just fine on Internet Explorer 11. With preact 7, I get a "stack overflow" message on IE's web developer console.
Are there any plans to make preact 7 work with IE11? I can understand that preact only supports modern browsers, but for better or worse, IE11 is a modern browser, and I can't rule out the possibility that my customers use it :-)
The text was updated successfully, but these errors were encountered: