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

Babel-preset-env? #331

Closed
cuong-nguyen opened this Issue Oct 26, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@cuong-nguyen

cuong-nguyen commented Oct 26, 2017

Hi @kentcdodds, I am still getting my head around this new preset.

Because not all browsers support new feature of ES, if you want to use those features, you need babel preset to transpile it so browsers can understand them. At this point, I understand the purpose of preset like es2015, es2016,...

And gradually browsers adopt more new ES features, it's no point in transpile and send polyfills down to client anymore, that's why they introduce babel-preset-env

Here are my questions:

We have the option to specify the browsers we want to target, e.g.

{ "presets": [ ["env", { "targets": { "browsers": ["last 2 versions", "safari >= 7"] } }] ] }

1/ How does babel know which browser has what features so it does not need to transpile those features?
2/ With above example, if users with safari version 6 go to our website, functions might not work, right?
3/ What does versions imply, the major version (59, 60) or the minor/patch (59.0.1,...)?
4/ Adopting this new preset, we need to know for sure which browsers we support?

Thanks :)

@kentcdodds

This comment has been minimized.

Owner

kentcdodds commented Nov 16, 2017

Hi @cuong-nguyen!

I was locked out of my house for a few hours the other day so I recorded answers to a bunch of my AMA questions and put them up on my 3 minute podcast. Here's your answer!

@kentcdodds kentcdodds closed this Nov 16, 2017

@cuong-nguyen

This comment has been minimized.

cuong-nguyen commented Nov 17, 2017

Thanks @kentcdodds. That helps a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment