Skip to content
This repository has been archived by the owner. It is now read-only.

Babel-preset-env? #331

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

Babel-preset-env? #331

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

Comments

@cuong-nguyen
Copy link

@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
Copy link
Owner

@kentcdodds 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
Copy link
Author

@cuong-nguyen cuong-nguyen commented Nov 17, 2017

Thanks @kentcdodds. That helps a lot.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants