Skip to content
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

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

Closed
nanjixiong218 opened this issue Jun 2, 2016 · 5 comments
Closed

Comments

@nanjixiong218
Copy link

"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
Copy link
Owner

xcatliu commented Jun 2, 2016

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

@xcatliu xcatliu closed this as completed in 9dccdf5 Jun 2, 2016
@xcatliu
Copy link
Owner

xcatliu commented Jun 2, 2016

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
Copy link
Owner

xcatliu commented Jun 2, 2016

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 xcatliu mentioned this issue Jun 3, 2016
@xcatliu
Copy link
Owner

xcatliu commented Jun 3, 2016

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

@nanjixiong218
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants