anandanand84 / technicalindicators

A javascript technical indicators written in typescript with pattern recognition right in the browser
MIT License
2.15k stars 557 forks source link

Include babel-plugin-transform-runtime as part of babel config? #118

Closed ben-berman-iex closed 6 years ago

ben-berman-iex commented 6 years ago

Hello, when I tried to use your library, I was not able to as it conflicted with the https://www.npmjs.com/package/bluebird Bluebird package I use. Apparently your usage of babel-polyfill overwrites Promises at the global scope.

After researching a bit, I came across this possible solution: https://babeljs.io/docs/plugins/transform-runtime/

From the documentation: "Another purpose of this transformer is to create a sandboxed environment for your code. If you use babel-polyfill and the built-ins it provides such as Promise, Set and Map, those will pollute the global scope. While this might be ok for an app or a command line tool, it becomes a problem if your code is a library which you intend to publish for others to use or if you can’t exactly control the environment in which your code will run."

It would be great if this was added to your build so we could use your package along with Bluebird and not have babel-polyfill set Promise on the global scope, thanks!

anandanand84 commented 6 years ago

This library doesn't add babel-polyfill but include keras-js which adds babel-polyfill. This is related to https://github.com/transcranial/keras-js/issues/109