React-tooltip: '"Symbol" is undefined' when using standalone-build on IE

Created on 5 Apr 2017  路  5Comments  路  Source: wwayne/react-tooltip

live-example: https://jsfiddle.net/GrafSonne/69z2wepo/75615/

hover over the text on IE and it works like expected, but throws an error. ("Symbol" is undefined)

Most helpful comment

babel-runtime is used to create the compiled/standalone JS of this library. Right at the top of the babel-runtime docs, it points out the caveats to using it:

NOTE: Instance methods such as "foobar".includes("foo") will not work since that would require modification of existing built-ins (Use babel-polyfill for that).

I tried using this with babel-polyfill, and can confirm that it fixes the issue.

However the issue with babel-polyfill is that it modifies globals, which isn't recommended for a library since this mutates functionality outside the scope of just the library.

Knowing this, I see two options:

  • Refactor the usage to not use a "for of"
  • Encourage users that need compatibility to import the NPM module and enable babel-polyfill in their own project (I'm doing this and it works perfectly)

All 5 comments

not just IE, but also on Safari 9.1 :)

Seeing the same error in Safari 9.1. It looks like the issue is with this line (compiled version)

babel-runtime is used to create the compiled/standalone JS of this library. Right at the top of the babel-runtime docs, it points out the caveats to using it:

NOTE: Instance methods such as "foobar".includes("foo") will not work since that would require modification of existing built-ins (Use babel-polyfill for that).

I tried using this with babel-polyfill, and can confirm that it fixes the issue.

However the issue with babel-polyfill is that it modifies globals, which isn't recommended for a library since this mutates functionality outside the scope of just the library.

Knowing this, I see two options:

  • Refactor the usage to not use a "for of"
  • Encourage users that need compatibility to import the NPM module and enable babel-polyfill in their own project (I'm doing this and it works perfectly)

shouldn't this be fixed in react-tooltip instead of us using additional libraries ?

So i found this https://github.com/zeit/next.js/issues/2060
and i imported into my wrapper of React-tooltip the core-js library. seems to fix this.

Hi, just sharing ways that worked for me:
1) Include <script src='https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/6.23.0/polyfill.min.js' /> in header - quite bad option, It's huge.
2) Add import 'babel-polyfill'
3) Add

import "core-js/fn/symbol/iterator"
import "core-js/fn/symbol"
Was this page helpful?
0 / 5 - 0 ratings

Related issues

abijames picture abijames  路  3Comments

rothwelljeff picture rothwelljeff  路  3Comments

tanykim picture tanykim  路  4Comments

jhlee4 picture jhlee4  路  3Comments

bonbonio picture bonbonio  路  4Comments