vsn4ik / bootstrap-submenu

Bootstrap sub-menus

Home Page:https://vsn4ik.github.io/bootstrap-submenu/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"Can't find variable: Symbol" on Poltergeist

vizcay opened this issue · comments

Hi, we've recently migrated to bootstrap v4.1.1 in our Ruby on Rails app, so we upgraded bootstrap-submenu v3.0.0 because we were using v2.x. We are very pleased how it looks and it was a life-safer after bootstrap v3.x dropped submenu support, thanks for your work.

After migration, everything looks fine, but this particular app is being feature tested with phantomjs v2.1.1. This driver doesn't supports all the new ES6 features, so the code on /dist that uses Symbol produces this error.

Because your source doesn't uses Symbol, I'm pretty sure this is being added on transpilaton with Babel, but not being JS my primary language or node my toolset I'm a little lost. I'm pretty sure there is some setting I can modify on package.json to output ES5 compatible code..

But do you thing is a good idea to output non ES5 compatible code on dist? Browser compatibilty will suffer (for example IE won't support it even now).

Well after more investigation this problem is pretty common, for example https://til.hashrocket.com/posts/b4c0e5d1a4-cant-find-variable-symbol.

One option is to use https://babeljs.io/docs/en/babel-polyfill/, but I didn't want to include a polyfill just for my tests to run. So I cloned your project and replaced for .. of with a simple for and is working again. I will fork and push in my profile if somebody else needs it.

Thanks @vizcay. Fixed in v3.0.1

@vsn4ik thanks, I've just tested it and is working with your changes.