-
Notifications
You must be signed in to change notification settings - Fork 110
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
Explore babel-preset-env #312
Comments
I can't get a good read on babel-preset-env. Does it actually include polyfills or is it for transformation only? If it's the latter, I don't think it would be a replacement for babel-polyfill. |
No, unfortunately it's not a replacement for babel-polyfill, it just results in less code being transpiled and, presumably, a smaller overall bundle size. However, something to only polyfill what's needed seems like it's in the cards for babel-preset-env, see this issue: babel/babel-preset-env#20 With that being said, on the server-side we might be able to get away with only polyfilling what's missing (e.g. generator functions, etc) and leave off the rest since node 6 has pretty decent ES6 coverage and it's a more predictable environment. We wouldn't be able to leave off the polyfill for the browser, however. |
Babel itself only transforms syntax so the preset just determines the least common denominator of plugins to run on the browsers/environments you specify in the options. Instead of changing your set of plugins yourself (turning off plugins over time) it should calculate that for you. |
I'm working on the polyfill part in babel/babel-preset-env#56 |
With #255 we now have
babel-polyfill
in place both on the client and server for necessary ES6+ support. In the case of the client, relatively modern browsers don't need the entire polyfill, and for the server since node 6 is already a pre-req for kyt, most of the polyfill is also unnecessary there.Although it's arguably still early for babel-preset-env, I think it might be good to experiment with it and see if we can use it to polyfill only what's necessary for newer browsers in the client bundle and node 6+ in the server bundle.
The text was updated successfully, but these errors were encountered: