Simplebar: Import specific polyfills

Created on 25 Oct 2017  路  3Comments  路  Source: Grsmto/simplebar

Currently, this script is importing the whole babel-polyfill https://github.com/Grsmto/simplebar/blob/0a7e1877b4f36862f45cb0471fd19811d243e1ae/src/simplebar.js#L5 which results in a 81.2 kb minified dist file.

IMO there are lots of unneeded polyfills in babel-polyfill package, it would be much better to import necessary polyfills only:

import 'core-js/fn/array/from';
...

What do you think about?

Most helpful comment

Ahhhh damn :p
Thanks very much for this, seems like I rushed this pretty badly in the latest release.
I'll take a serious look at it! :)

All 3 comments

We are using babel-preset-env so unless I'm using it wrongly, it should not import every polyfills but only the ones required.
The script size seems big tho, I'll investigate.
Ref #112

babel-preset-env imports all polyfills that target environment requires. You might need babel-transform-runtime plugin to import only used polyfills, or wait for https://github.com/babel/babel-preset-env/issues/246 馃槂.


Edit: this issue could be resolved with [email protected], see https://github.com/babel/babel-preset-env/pull/241

Ahhhh damn :p
Thanks very much for this, seems like I rushed this pretty badly in the latest release.
I'll take a serious look at it! :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bennymeg picture bennymeg  路  3Comments

dyegonery picture dyegonery  路  5Comments

Grsmto picture Grsmto  路  7Comments

adjourn picture adjourn  路  6Comments

danielg42 picture danielg42  路  5Comments