You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently we are trying to execute ES6 tests in a module where we have the json-api as a dependency. When I require 'babel/register' in one of my build steps I get the error only one instance of babel/polyfill is allowed
The problem is, that we have two different versions of babel as dependencies (the one we specified in our top-level-module and the other one which is the json-api's dependency) and both try to add the `global._babelPolyfill´. Even though I've seen #11 this causes us serious headaches. Could you consider specifying babel as a dev-dependency again?
The text was updated successfully, but these errors were encountered:
This was initially brought up in Babel's support chat. The recommended approach is for libraries to use the http://babeljs.io/docs/usage/runtime/ transformation to rewrite global usage to point at a non-global version of the polyfill. The downside of this is that libraries cannot use new ES6 prototype methods methods because these cannot be polyfilled without mutating globals. When using runtime you can however access these methods using non-standard names like Array.includes instead of Array.prototype.includes.
I've been loading the polyfill thus far precisely to handle the cases the runtime transformer doesn't support (though I've also been loading the runtime transformer, which I guess is a little redundant...whoops). But if ditching the polyfil and the prototype methods now is the only option for solving this issue, I'm willing to do that.
Currently we are trying to execute ES6 tests in a module where we have the json-api as a dependency. When I require 'babel/register' in one of my build steps I get the error
only one instance of babel/polyfill is allowed
The problem is, that we have two different versions of babel as dependencies (the one we specified in our top-level-module and the other one which is the json-api's dependency) and both try to add the `global._babelPolyfill´. Even though I've seen #11 this causes us serious headaches. Could you consider specifying babel as a dev-dependency again?
The text was updated successfully, but these errors were encountered: