Skip to content
This repository has been archived by the owner on May 11, 2018. It is now read-only.

Edge 14 doesn't get block scoping detected #207

Closed
mgol opened this issue Mar 13, 2017 · 8 comments
Closed

Edge 14 doesn't get block scoping detected #207

mgol opened this issue Mar 13, 2017 · 8 comments
Labels

Comments

@mgol
Copy link

mgol commented Mar 13, 2017

Edge 14 passes all tests in the Kangax ES6 table in the const & let sections:
http://kangax.github.io/compat-table/es6/

However, specifying Edge >= 14 as a target still transpiles const to var:
https://babeljs.io/repl/#?babili=false&evaluate=true&lineWrap=false&presets=env&targets=&browsers=Edge%20%3E%3D%2014&builtIns=false&experimental=false&loose=false&spec=false&playground=false&code=const%20x%20%3D%202%3B%0A

I've looked at the code base. This is what I found:

  1. Edge is not included in the list of environments that don't require the es2015-block-scoping transform: https://github.com/babel/babel-preset-env/blob/v1.2.1/data/plugins.json#L20-L27
  2. The es2015-block-scoping transform seems to rely only on the results of const & let tests if I undersdand the code correctly: https://github.com/babel/babel-preset-env/blob/v1.2.1/data/plugin-features.js#L13-L18

It seems to me all conditions for Edge 14 to be accepted should be met?

@existentialism
Copy link
Member

@mgol probably an issue where we're not assuming edge >= 12 includes everything from ie 11, and the compat-table data only lists ie11 under const/let, we'll get a fix out!

@mgol
Copy link
Author

mgol commented Mar 13, 2017

I was thinking that might have been the case but IE 11 doesn't pass all const/let-related tests so it's not included under transform-es2015-block-scoping either.

@mgol
Copy link
Author

mgol commented Mar 13, 2017

Oh, you mean that some tests under const/let are passed by IE 11 so the edge key is not included there while other tests are only passed by Edge.

That would mean Edge is not listed under anything that was partially (but not fully) supported in IE 11. That seems to be the case, indeed, as e.g. Edge is missing from es6.map: https://github.com/babel/babel-preset-env/blob/v1.2.1/data/built-ins.json#L102-L109.

@existentialism
Copy link
Member

Yeah, we need to augment our checks to include previous browser(s) in the same family (ex. Chakra).

@mgol
Copy link
Author

mgol commented Mar 13, 2017

For reference, this is relevant upstream compat-table code taking the family into account:
https://github.com/kangax/compat-table/blob/e2a18bec5a4d951e749ad1cac848eade03d98c87/build.js#L431

@hzoo
Copy link
Member

hzoo commented Mar 14, 2017

If you have time to check this out it would be great @mgol

All the code to generate the json files are in https://github.com/babel/babel-preset-env/blob/master/scripts/build-data.js. Maybe we need to redo #86?

@mgol
Copy link
Author

mgol commented Mar 14, 2017

I can look into it.

@existentialism
Copy link
Member

Released in https://github.com/babel/babel-preset-env/releases/tag/v1.2.2!

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

No branches or pull requests

3 participants