-
Notifications
You must be signed in to change notification settings - Fork 47.2k
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
React app not rendering in IE11 and below #8379
Comments
@FarhadG thanks for the report. Can you try to reproduce the error in dev? A diff of dependencies isn't too useful alone, unfortunately.We'd need a reproducible test case or a stack trace to try and narrow down the root cause here. |
Thanks for the quick response, @aweary . Did you want me to compile the app in |
Have you tried following the link in that error? It should include the information explaining why the error happened. |
I did, @gaearon. It didn't make sense why it would work in Chrome and Firefox but not in IE11 and below. Thoughts? |
Maybe you enabled |
Going to give this a try, @gaearon, however, it's baffling that it's been working all along until a few days ago. |
Either way, as long as React is not being built for production. This should at least give us a better idea of where the issue is occurring. |
Looked through our codebase and we were not explicitly using |
So, we served our app in |
@FarhadG Are you absolutely confident? Like maybe you use a preset that "optimizes" React which might include another preset, which might ultimately include that plugin. |
@FarhadG I hit this on my current project and had to include the Symbol polyfill. I do this by adding a /**
* Place any polyfills here. This project uses core-js:
* https://github.com/zloirock/core-js
*
* ES6:
* https://github.com/zloirock/core-js/tree/master/es6
*/
//...
// We need Symbol support for some React optimizations
require('core-js/modules/es6.symbol') Edit: We use the |
That was our original idea after your suggestion, @gaearon. I followed these particular presets: {
"presets": ["es2015", "react", "stage-0"],
"plugins": ["react-hot-loader/babel"]
} ... and didn't see them requiring anything to do with the Just gave it a try, for trying's sake, @nhunzaker, and the issue persists. |
I'm having the same issue. However I have two apps - one running 15.1.0 and one running 15.4.0, on a more recent update path. https://www.votesforschools.com/ (15.1.0) In each case in IE11 the exception is this: Which outputs:
However this is only happening in deployed production. If I do a production build locally and serve it from Python SimpleHTTPServer this exception does not trigger. I just want to report this, but as of tomorrow I'm rolling off this project as I'm starting a new job in the new year so I won't have access to the source code after this. These are the only babel plugins being used (this is from our www config, admin is again slightly different)
Update 1: In IE now getting an exception box on our dev environment (but not on production itself). Full text is:
On Production it's just the above one, without the mention of CoreLayout (which is just the app wrapper that called ReactDOM.render) Update 2: I've done the above with the polyfill. I have checked in the console and Update 3: Checked the node_modules folder, Update 4: One project was causing a bit of a red herring. The project that is currently running on React 15.1.0 has had no dependency updates since October in the package.json file, however packages are marked with the caret I've changed this to tilde version locking (i.e. I've rolled back the second project to 15.3.2 and it's also working fine now. |
We'll need a complete project reproducing this to investigate. |
Thanks for including your debugging strategies, @tanepiper. Here's what we did in trying to figure out what the problem is:
|
@gaearon See updates above - rolled back to 15.3.2 and it's working so it's a recent change. Also turns out the CI was pulling React 15.4 anyway instead of 15.1 due to incorrect I will attempt to see if I can draw out a reproducible case for this but digging in a little bit it looks like whatever generates children for https://github.com/facebook/react/blob/master/src/shared/utils/traverseAllChildren.js is passing an object, not an array and that's what is triggering this exception. |
The problem is that React doesn't "recognize" its own element. This likely happens because of the failed This might mean that To debug it further I recommend finding this fragment in your bundle:
You should see it two times (once from Try adding logs of The reason this is new in 15.4.0 is because there only used to be one version of this code, but now it's in both packages (intentionally). |
Update: A coworker was able to find a workaround that involved removing the ReactDOM import from inside the .jsx file and instead listing it under the plugins section of webpack.config.js. Original File Contentswebpack.config.js
routes.jsx
Updated Fileswebpack.config.js
routes.jsx
While this works, I still would like to get to the root cause. For the record, here is what our devDependencies looks like:
|
Have you had a chance to try my suggestion from the comment above? #8379 (comment) |
@gaearon I'm encountering this issue as well. I narrowed it down to some combination of |
It would really help if you could follow my suggestion above and let me know your findings. |
Great! As you can see they are different. Can you now try to look into what makes |
I fixed this by enforcing a load order in my webpack bundle:
Thanks for your patience and your infinite wisdom 😉 @gaearon |
I’m going to close this because it doesn’t appear to be a bug. It’s unfortunate this broke some apps but it’s very hard to protect against cases like this. In general my recommendation is that you should run any global polyfills before any other code in the bundle. Since polyfills are effectively modifying the environment, one should take care to do that consistently. |
I ran into this when adding I also had to fully clean up my environment (namely delete the |
This just started happening to me again in the last week in IE11 (ive resolved this same bug in the past using the above suggestions).
The error:
|
Nothing worked for me either, changing the order of the polyfill or anything else.
After adding this I was successfully able to run the react app in IE 11 |
This is to avoid loading anything before loading the polyfill, otherwise we risk loading dependencies (such as React) before it. This was causing the compatibility page to fail somehow. See facebook/react#8379 Fixes #6562
Hello Guys I had similar issue but then in my index.js i used <script src="https://cdn.polyfill.io/v2/polyfill.min.js"></script> and my issue was resolved. |
We need to include babel-polyfill in our application as older versions of Internet Explorer are not capable of the latest EcmaScript features and functionality. facebook/react#8379 https://babeljs.io/docs/en/babel-polyfill.html
I have read all the comments and if I read correctly, both working solutions are either, eject the webpack config or add cdn package, just to support IE11? |
You don't need to add anything to webpack config. |
React 16 requires a few runtime JS features that are missing in IE11, but easy to add with polyfills. See here for how to add them: https://reactjs.org/docs/javascript-environment-requirements.html Just make sure you put those imports in the entry point of your application, before any other imports. If this didn't help, you might be having the same problem as #8379 (comment). TLDR is that if you choose to polyfill I'm going to lock to prevent further confusion since comments about webpack are already confusing people into ejecting, which is absolutely unnecessary for this. But if you do have a custom webpack config then maybe your problem is similar to #8379 (comment) which provides a clue about how to fix it. |
Do you want to request a feature or report a bug?
BUG
What is the current behavior?
App doesn't render in IE11 and below.
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://jsfiddle.net or similar (template: https://jsfiddle.net/reactjs/69z2wepo/).
What is the expected behavior?
Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
We've temporarily shrink-wrapped our dependencies so that we can continue to serve our app. We're starting to believe that it's coming from a dependency that
react
,apollo
orwebpack
may be relying on...Shrink-wrapped versions of our dependencies (left is the new one that's broken and the right one is the old one that continues to work across all browsers) https://www.diffchecker.com/SyaJUcsk
The text was updated successfully, but these errors were encountered: