xcatliu/react-ie8

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

nanjixiong218 opened this issue · 5 comments

"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' ";

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:
#24
reduxjs/react-redux#133
reduxjs/react-redux#227
reduxjs/react-redux@a94ea6d

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';

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/

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