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

Import specific polyfills #120

Closed
idiotWu opened this issue Oct 25, 2017 · 3 comments
Closed

Import specific polyfills #120

idiotWu opened this issue Oct 25, 2017 · 3 comments

Comments

@idiotWu
Copy link

idiotWu commented Oct 25, 2017

Currently, this script is importing the whole babel-polyfill

import 'babel-polyfill';
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?

@Grsmto
Copy link
Owner

Grsmto commented Oct 25, 2017

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

@idiotWu
Copy link
Author

idiotWu commented Oct 25, 2017

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 babel/babel-preset-env#246 😃.


Edit: this issue could be resolved with babel-preset-env@2.0, see babel/babel-preset-env#241

@Grsmto
Copy link
Owner

Grsmto commented Oct 25, 2017

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! :)

@Grsmto Grsmto closed this as completed in ac88ff1 Nov 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants