scotthovestadt / schema-object

Enforce schema on JavaScript objects, including type, transformation, and validation. Supports extends, sub-schemas, and arrays.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`babel-polyfill` should be included in application scope

akoenig opened this issue · comments

First of all, thanks for this library. It was exactly what we needed in one of our projects.

There is only one thing which hit us hard: The inclusion of babel-polyfill as a direct dependency. We scanned the codebase and identified that you wrapped it into the condition for adding the polyfill only when there is no pendant on global._babelPolyfill. This works great if you use the exact same version within your application. Otherwise you get an Error: only one instance of babel-polyfill is allowed error.

Anyway, in my opinion using the respective polyfills should be in the scope of the application which is consuming your library. What do you think? :) Are you open for a PR in this case?

I'll definitely accept a pull request. The test coverage is strong enough that if tests pass I'm OK with deploying it.

I also have a todo item to update Babel to the latest version -- I'm going to do that right now.

It looks like the only reason I'm doing that is because of this bug:
https://phabricator.babeljs.io/T2877

It might be best to wait until they fix it. Will upgrading to the latest Babel solve your issue?

I published 4.0.4 with the latest versions of Babel.