IE8 support
I recently upgraded the react router from 1.0.0-rc1 to 1.0.0-rc3 which breaks compatibility with IE8 with the following error: Invariant Violation: ReactCompositeComponent.getChildContext(): childContextTypes must be defined in order to use getChildContext()
I have had to roll back to 1.0.0-rc1 for the moment.
Any Thoughts?
Many Thanks
Adam
Do you have any more details on where this error is being thrown?
provide more details and we will reopen. Hard to help with that at the moment.
hey guys, I'm at a company that also has to support ie8 (government man...) and I'm 99% sure I know what's going on. Basically you can't do things like https://github.com/rackt/react-router/blob/master/modules/Router.js#L30. where you define static props right on the class, instead you have to do things like this: https://github.com/rackt/react-redux/pull/135/files where you just put the props at the bottom. It's really simple and I can open a PR to fix it. I'll letcha know how it goes! (the problem is that object.defineProperty it un-polyfillable and that particular interaction needs object.defineProperty.
That's not correct - the code above is actually not valid in any browser; it runs because we transpile it through Babel into legal code.
I'm well aware of the transpiler being used. When you use static properties, the transpiler (babel) uses defineProperty, when you don't have static props, it doesn't use defineProperty. Check my PR that I linked for a full discussion.
sorry this is the discussion: https://github.com/rackt/react-redux/issues/133
My bad! I wasn't aware it was a consequence of that specific Babel interaction.
To clarify - this is broken even when using es5-shim?
Yup, Completely broken and unfixable. Class properties are still experimental (https://babeljs.io/docs/plugins/). I have a PR that I'm about to setup that removes them completely. Not sure if there is a way to lint against this though as I couldn't find a static properties type rule...
On Thu, Nov 12, 2015 at 2:54 PM, Jimmy Jia [email protected] wrote:
To clarify - this is broken even when using es5-shim?
— Reply to this email directly or view it on GitHub https://github.com/rackt/react-router/issues/2314#issuecomment-156216539 .
@mattydoincode
I'd drop up to Babel stage 1 from stage 0 if you want to enforce the non-use of class properties.
Although I think Babel 6 moved them up to the stage 1 preset, so worth tacking a note somewhere.
You can also blacklist the specific Babel transformation if you want to be more explicit.
I'm still researching locally to see exactly how ie8 is responding to everything. Will keep you posted! Just want to make sure I can back everything up with real world results.
On Thu, Nov 12, 2015 at 3:06 PM, Jimmy Jia [email protected] wrote:
@mattydoincode https://github.com/mattydoincode
I'd drop up to Babel stage 1 from stage 0 if you want to enforce the non-use of class properties.
Although I think Babel 6 moved them up to the stage 1 preset, so worth tacking a note somewhere.
— Reply to this email directly or view it on GitHub https://github.com/rackt/react-router/issues/2314#issuecomment-156219537 .
in my project say "setter & getter is not support in this javascript engine" and i try to read your code. i find this is case by "export * from "./xx" some code like this.
https://phabricator.babeljs.io/T7322
hello you mean this can fix the issues? @SimenB
But we refer to the use of the compiled lib file, is that we want to compile the webpack which includes nodo_modules?@SimenB
If that issue is addressed, the router would be compiled in an IE8 compatible way. It's not something you can fix on your end, either the router has to export in some other way, or Babel need to change how it's compiled.
I haven't tried using the router with IE8, but you can probably import directly from lib/ (unsure how supported it is, so you might want to lock down you version of the router), to avoid the unsupported code in the entry point.
thank you very much for your help. i have try to babel compiled by IE8 way. but it still not work. it may be other npm class libraries made. i think this too many libraries not support Ie8.
i from china ,my english is poor, thanks agan.