Core-js: What is the difference between fn, library, es6, modules and etc ?

Created on 7 Nov 2017  路  1Comment  路  Source: zloirock/core-js

I feel confused with these folders:

core-js/core
core-js/es6
core-js/fn
core-js/library
core-js/modules

I want to require only needed module, but which folder should I choose ? What is the difference ? It is so confusing without relative descriptions.

question

Most helpful comment

  • modules folder contains implementations of polyfills without dependencies. You can use it only if you understand what are you doing - it's enough dangerous.
  • core, es5, es6, es7 and web contains features related only those namespaces. For example, core-js/es6/promise will add a Promise polyfill, but without .finally and .try methods. In the next major core-js version, es5, es6and es7 will be replaced to es for stable ECMAScript features and esnext for ECMAScript proposals.
  • fn folder contains entry points for each feature, it's the better way for most cases. For example, core-js/fn/promise will add a Promise polyfill with all required features and dependencies.
  • library folder contains copies of all of the previous folders, but they work without global namespace pollution. For example, core-js/library/fn/promise returns Promise polyfill, but without creating global Promise variable.

>All comments

  • modules folder contains implementations of polyfills without dependencies. You can use it only if you understand what are you doing - it's enough dangerous.
  • core, es5, es6, es7 and web contains features related only those namespaces. For example, core-js/es6/promise will add a Promise polyfill, but without .finally and .try methods. In the next major core-js version, es5, es6and es7 will be replaced to es for stable ECMAScript features and esnext for ECMAScript proposals.
  • fn folder contains entry points for each feature, it's the better way for most cases. For example, core-js/fn/promise will add a Promise polyfill with all required features and dependencies.
  • library folder contains copies of all of the previous folders, but they work without global namespace pollution. For example, core-js/library/fn/promise returns Promise polyfill, but without creating global Promise variable.
Was this page helpful?
0 / 5 - 0 ratings