xcatliu / react-ie8

Make your React app work in IE8
http://react-ie8.xcatliu.com/
997 stars 162 forks source link

Babel transform "export xx from 'xxx' " to Object.defineProperty #32

Closed nanjixiong218 closed 8 years ago

nanjixiong218 commented 8 years ago

"Babel transforms your import to Object.defineProperty which doesn't exist in IE8。" It should be 'export' ,not 'import' . IE8 has Object.defineProperty Object.defineProperty. now Babel fixed the transform, but has another problem: Babel transform "export xx from 'xxx' " to Object.defineProperty, like: " Object.defineProperty(exports, 'LOCATION_CHANGE', { enumerable: true, get: function get() { return _reducer.LOCATION_CHANGE; } }); " the accessor property not support in ie8. so cannot use react-router-redux because it use "export xx from 'xxx' ";

xcatliu commented 8 years ago

Thank you very much!

First yes you are right, babel fixed import issue. Now it's fine to use import. But I'll keep this issue in the README.md, for someone who are still using the old version of babel.

Second, I checked the link you gave, and found that I have made a mistake, IE8 did support Object.defineProperty, here is what caniuse says:

IE8 has virtually no ES5 support, but does support Object.defineProperty, Object.getOwnPropertyDescriptor, JSON parsing & Property access on strings

For this issue, I'll update the README.md later.

The last thing, I think you can report an issue (or create a pull-request) to react-router-redux if you want them to support IE8, although I don't know whether they will support or not.

Here is the related things that I have done before: https://github.com/xcatliu/react-ie8/issues/24 https://github.com/reactjs/react-redux/issues/133 https://github.com/reactjs/react-redux/issues/227 https://github.com/reactjs/react-redux/commit/a94ea6d01853d6262c278e9196246597153c97d9

xcatliu commented 8 years ago

BTW, you cannot write code like

export xx from 'xxx';

It should be something like this:

export * from 'xxx';

or this:

export { xx } from 'xxx';
export { yy as yyy } from 'yyy';
xcatliu commented 8 years ago

It's better if you can beautify you issue content by using correct format of markdown.

Here is a guide: https://guides.github.com/features/mastering-markdown/

xcatliu commented 8 years ago

Related post: http://www.aliued.com/?p=3240

nanjixiong218 commented 8 years ago

Thanks for your feedback, I got it, the next time i will beautify my issue ☺