Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CoreJS to shim or not to shim

Tags:

javascript

I'm using https://github.com/zloirock/core-js as an ES6 polyfill for TypeScript 1.5.0 I got from npm

I'm curious what's the difference between:

 // Default
 require('core-js');

And:

 // Shim only
 require('core-js/shim');

Another question, what are the other alternatives for ES6 polyfill?

like image 770
Hao Avatar asked Jul 19 '15 07:07

Hao


1 Answers

The shim.js polyfills all standard ECMAScript methods. The index.js polyfills non-standard methods in addition.

See the required sub modules in the source code:

  • index.js (these are not standard)
  • shim.js (these are standard)
like image 80
Sebastian Nette Avatar answered Sep 23 '22 11:09

Sebastian Nette