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

In IE11 [object(_Symbol )] is not an object exception is getting thrown (T7348) #4286

Closed
babel-bot opened this issue May 9, 2016 · 14 comments
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue

Comments

@babel-bot
Copy link
Collaborator

Issue originally made by Hrushikesh Deshmukh (hrushi.deshmukh)

Bug information

  • Babel version: 6.7.7
  • Node version: 6.1.0
  • npm version: 3.8.6

Description

I am using webpack along with react and redux. While the applications works fine with Chrome and FF, on IE11 I am not constantly getting this uncaught exception.

'use strict';

var isObject = __webpack_require__(86);
module.exports = function (it) {
  if (!isObject(it)) throw TypeError(it + ' is not an object!');
  return it;
};

/*****************
 ** WEBPACK FOOTER
 ** ./~/core-js/modules/_an-object.js
 ** module id = 85
 ** module chunks = 0
 **/
//# sourceURL=webpack:///./~/core-js/modules/_an-object.js?

See below the stack--

TypeError: undefined is not an object!
   at module.exports (eval code:5:22)
   at defineProperty (eval code:78:3)
   at Anonymous function (eval code:6:3)
   at eval code (eval code:238:37)
   at Anonymous function (http://localhost:2992/assets/main.bundle.js:554:2)
   at __webpack_require__ (http://localhost:2992/assets/main.bundle.js:48:12)
   at eval code (eval code:3:1)
   at Anonymous function (http://localhost:2992/assets/main.bundle.js:548:2)
   at __webpack_require__ (http://localhost:2992/assets/main.bundle.js:48:12)
   at Anonymous function (eval code:4:1)
@babel-bot
Copy link
Collaborator Author

Comment originally made by @loganfsmyth

This isn't much to go on. What functions does that stack trace translate into?

@babel-bot
Copy link
Collaborator Author

Comment originally made by @mrhota

Getting same thing. Using gulp+webpack+babel for transpile+build. React, Redux, Axios.

Axios uses Promise, so we have to use a polyfill for IE11. Babel's site recommended babel-polyfill, so that's what I tried.

I have followed the (simple?) instructions on the babel site:

// in webpack.config.js
...
entry: ['babel-polyfill', './util/common.js']
...

// in ./util/common.js
require('babel-polyfill');
...

IE11 (and IE10) complain about 'Exception thrown and not caught' and point at the line indicated in the initial report. After spending many hours searching for solutions my only question is: why hasn't anyone else seen this?

@babel-bot
Copy link
Collaborator Author

Comment originally made by @mrhota

Here's what I got from IE11. Doesn't seem particularly helpful, but who knows...

Additionally, IE's debugger first opens _an-object.js (as in the original report above) when I make it break on unhandled exceptions/errors. For some reason, it then opens _property-desc.js as the source of the error.

[Main Thread]
module.exports [Line: 1, Col: 1], _property-desc.js
defineProperty [Line: 112, Col: 3], es6.symbol.js
Anonymous function [Line: 1, Col: 1], _dom-create.js
Anonymous function [Line: 1, Col: 1], _fails.js
__webpack_require__ [Line: 30, Col: 1], bootstrap 94260bf418c488709c41
Anonymous function [Line: 36, Col: 1], shim.js
__webpack_require__ [Line: 30, Col: 1], bootstrap 94260bf418c488709c41
Anonymous function [Line: 30, Col: 1], index.js
Anonymous function [Line: 25, Col: 2], index.js
__webpack_require__ [Line: 30, Col: 1], bootstrap 94260bf418c488709c41
Anonymous function [Line: 1, Col: 1], common.js
__webpack_require__ [Line: 30, Col: 1], bootstrap 94260bf418c488709c41
Anonymous function [Line: 13, Col: 2], common.js
__webpack_require__ [Line: 30, Col: 1], bootstrap 94260bf418c488709c41
Anonymous function [Line: 3, Col: 1], common.js
Global code [Line: 1, Col: 1], bootstrap 94260bf418c488709c41

@babel-bot
Copy link
Collaborator Author

Comment originally made by Hrushikesh Deshmukh (hrushi.deshmukh)

wheww....finally I resolved this error. It seems there is some issue with either babel or webpack configuration if you use babel-polyfill as entry file. I simply removed the 'babel-polyfill' entry file from webpack.config and added it in my index.html like below and it worked.

 <script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.6.15/browser-polyfill.min.js"></script>

@babel-bot
Copy link
Collaborator Author

Comment originally made by Roderick Bovee (roderick)

I'm having this same issue with Firefox 31 (and an unknown version of Mobile Safari).

I'm having issues getting a proper traceback out of Firefox, but stepping through it looks like this is all happening in this definition in es6.symbol.js:

// 19.4.3.4 Symbol.prototype[@@toPrimitive](hint)
$Symbol[PROTOTYPE][TO_PRIMITIVE] || require('./_hide')($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf);

Maybe this means it's an upstream issue in core-js?

Moving from a require(babel-polyfill.js) to including from the CDN fixes the issue for me (both version 6.9.1).

@babel-bot
Copy link
Collaborator Author

Comment originally made by @nathanhleung

I'm getting this same problem with Webpack - based on the stack trace, it seems like the problem is that $Symbol[PROTOTYPE] is not an object (see screenshot below).

Screenshot: https://i.imgur.com/sXUWKwJ.png

There's a related issue here, in core.js (zloirock/core-js#189) which says that core-js shouldn't be put through the babel-loader, but after disabling it ('!!babel-polyfill' in the entry array) it still didn't work for me.

Including from the CDN makes it work for me, but I'm still curious as to why the instructions on the babel site to add the polyfill to the entry array aren't working.

@magnus-eriksson
Copy link

magnus-eriksson commented Sep 30, 2016

Why is this issue closed when the issue still is very much an issue? We rather not have an extra <script src"..."> in the header, and the documentation still tells us to use babel-polyfill as entry point in webpack.

@danez
Copy link
Member

danez commented Sep 30, 2016

If it was the error that @nathanhleung mentioned, then it is fixed with babel 6.16. see #3686

@magnus-eriksson
Copy link

magnus-eriksson commented Sep 30, 2016

The issue I have is this:

  • No polyfill = "Symbol is not an object" in IE 11
  • Installed babel-polyfill 6.16.0 via npm, include via webpack entry: ['babel-polyfill', 'js/main.js'] = Uncaught Exception (in the same file/row as in the description in the initial problem for this issue).
  • Loading babel-polyfill 6.16.0 via CDN, it works in IE every other time I reload the page (no error, so I'm not sure it this is babel or something else that's going on).

Have the latest versions of babel-core, babel-loader and babel-preset-es2015.

@thesublimeobject
Copy link

Same issue here. When loaded as an entry point or imported IE throws an uncaught exception pointing to the same line as above, but if included as a separate file beforehand it works fine.

@gregorym
Copy link

Can we reopen this issue, it is still a problem.

@digitalmaster
Copy link

I'm still having this issue as well.

@Sashazq
Copy link

Sashazq commented Feb 20, 2018

same problem

@gerardramosm89
Copy link

Having the same issue:

    "babel-plugin-transform-runtime": "6.9.0",
    "babel-preset-es2015-without-strict": "0.0.4",
    "babel-preset-es2015": "^6.24.1",
    "babel-preset-react": "6.11.1",
    "babel-preset-stage-3": "^6.22.0",
    "babel-runtime": "6.9.2",
    "babelify": "7.3.0",

@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Jul 19, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Jul 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue
Projects
None yet
Development

No branches or pull requests

8 participants