xcatliu / react-ie8

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

Expected identifier #1

Closed xcatliu closed 8 years ago

xcatliu commented 8 years ago

http://stackoverflow.com/questions/17490398/ie8-expected-identifier-error http://tiffanybbrown.com/2013/09/10/expected-identifier-bug-in-internet-explorer-8/ http://stackoverflow.com/questions/14448951/expected-identifier-error-from-ie8-and-ie7-when-object-has-new-as-property-n http://stackoverflow.com/questions/5584249/javascript-vs-ie8-expected-identifier-string-or-number

xcatliu commented 8 years ago

Maybe caused by the reserved words using in IE8.

xcatliu commented 8 years ago

All third-party libraries which use babel src --out-dir lib have this problem. I opened a issue: https://phabricator.babeljs.io/T6868

xcatliu commented 8 years ago

es3ify can deal with this problem if you are using browserify to bundle js.

Remember to use global transform:

b.transform('es3ify', { global: true });
xcatliu commented 8 years ago

@yeatszhang What option should be set if we use webpack to bundle js?

yeatszhang commented 8 years ago

maybe use es3ify-loader

xcatliu commented 8 years ago

es3ify-loader with webpack example: https://github.com/xcatliu/react-ie8/blob/master/examples/fetch-ie8/webpack.config.js#L17

xcatliu commented 8 years ago

Stackoverflow solution: http://stackoverflow.com/questions/33512715/babel-6-0-20-modules-feature-not-work-in-ie8/33513000#33513000