babel: IE8 raises `Expected identifier` exception on `browser-polyfill.js`

babel-core/browser-polyfill.js on a fresh npm install contains iterator.throw and iterator.return (rather than ["throw"] and ["return"]) which consequently makes it incompatible with older browsers.

The actual error was fixed in regenerator a few days ago, but the npm version of babel still installs the old syntax https://github.com/facebook/regenerator/commit/97466d3d540243702496b24426765f0022f4bc07

To reproduce, I just freshly npm installed babel-core and searched for .throw in resulting browser-polyfill.js

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Reactions: 2
  • Comments: 20 (9 by maintainers)

Commits related to this issue

Most upvoted comments

@theredpea I’m noticing this as well on v6.26.0

        if (delegate.iterator.return) {

I’m having this issue as well: line 7178 of the unminified script has deletgate.iterator.return. Additionally there is a reserved word delete: in the minified script so neither will load for me in IE8 now. Confirmed in 7.0.0-beta.56 and 6.26.0.

I thought this was babel problem but remidied (partially, so far…) with new UglifyJsPlugin({ ..., uglifyOptions: { ..., ie8: true } })

@sebmck related. IIRC, uglify not transform iterator["throw"] -> iterator.throw, looks like simply need rebuild browser-polyfill with latest regenerator.