Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ES6-only polyfills #184

Closed
vkrol opened this issue Mar 27, 2016 · 6 comments
Closed

ES6-only polyfills #184

vkrol opened this issue Mar 27, 2016 · 6 comments
Labels

Comments

@vkrol
Copy link

vkrol commented Mar 27, 2016

Hello! Thank you for your work.

Can you explain me, please, why you are not provide ES6-only polyfills? If I need to support only ES5 (not ES3) runtimes, why I need to include ES5 polyfills in my bundle when I imported "core-js/es6" entry point?
I read the changelog to the 2.1.0 version (https://github.com/zloirock/core-js/releases/tag/v2.1.0, section "Separated ES5 polyfills moved to the ES6 namespace. Why?"), but still do not understand.

Thanks!

@zloirock
Copy link
Owner

ES6 changes behavior most added in ES5 features. Object methods, Array methods... almost all excluding some features like Array.isArray or Date.now. I don't see any reason implement something in the ES5 namespace with ES5 logic and after that replace or wrap it in the ES6 namespace - it's size and performance issue. Size difference with old conception for core-js/es6 should be only some percent. It's the first reason.

The second - I don't know any popular engine, completely correct by ES5 spec - they all have some bugs and core-js fixes them.

In the future, for example core-js@3, I think, ES5 / ES6 / ES7 namespaces will be removed and for ECMAScript will be available only 2 main namespaces - for stable ES and for ES proposals.

@vkrol
Copy link
Author

vkrol commented Mar 29, 2016

Thank you for information!

@RehanSaeed
Copy link

Just to confirm that I have this right, I can currently import ES5, 6, or 7 separately:

import "core-js/es5";
import "core-js/es6";
import "core-js/es7";

According to caniuse.com ES5 is supported on all current browsers but I might still need ES5 to fix broken browser implementations?

@zloirock
Copy link
Owner

@RehanSaeed ES6 changes behaviour almost all features added in ES5, so core-js/es6 entry point includes almost all of them. Also, as you wrote, it's required for fixing broken browser implementations.

@RehanSaeed
Copy link

Do you recommend importing the es5 code if I want to support 99% of browsers or the last two versions (Including IE 10 onwards)?

@zloirock
Copy link
Owner

Depends on your goals and objectives.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants