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

Use chrome data when android is absent #10790

Merged

Conversation

JLHwung
Copy link
Contributor

@JLHwung JLHwung commented Dec 2, 2019

Q                       A
Fixed Issues? Fixes #10789
Patch: Bug Fix? Yes
Tests Added + Pass? Yes
License MIT

In this PR we introduce a getLowestImplementedVersion which adds chrome support data as fallback when android support data is absent, by doing preset-env would not introduce unnecessary transforms for Android >= 52, which should share the same features sets as Chrome >= 52.

The previous behaviour is revealed in this CI failure. This behaviours renders settings like last 2 versions unusable and preset-env will thus apply all the transforms.

@JLHwung JLHwung added pkg: preset-env PR: Bug Fix 🐛 A type of pull request used for our changelog categories labels Dec 2, 2019
Copy link
Member

@zloirock zloirock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nicolo-ribaudo
Copy link
Member

@zloirock
Copy link
Member

zloirock commented Dec 2, 2019

The existence of any android versions greater than 4.4.4 in browserslist looks like a bug.

@JLHwung
Copy link
Contributor Author

JLHwung commented Dec 2, 2019

According to the caniuse description, the android whose version are greater than 4.4.4 refers to Android 5-6.x WebView. We could propose to add a new android-webview agent to caniuse-db but I think a single android works fine here as long as the version does not overlap with Android Browser.

My first approach was somehow similar to core-js-compat: map android >= 36 to chrome >= 36. But I realize that it would make queries like android >= 4 converted to { android: "4.0.0", chrome: "76.0.0" } so I switch to current implementation.

@zloirock Wouldn't current approach in core-js-compat map android 5 to chrome 5? I think we should emit warnings for 5 <= android < 30 in which both WebView and Android Browser are not available.

@zloirock
Copy link
Member

zloirock commented Dec 2, 2019

@JLHwung browserslist will throw an error on android 5, so not.

For Android 5+ Chrome and WebView we have and_chr -> chrome.

See compat-table/compat-table#801

@JLHwung JLHwung force-pushed the use-chrome-data-when-android-is-absent branch from 96be294 to 7402a40 Compare December 4, 2019 16:10

Using modules transform: auto

Using plugins:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The plugins listed here is generated from a sort-of modern browserslist configuration. It can help us prioritize bug fixes in the current transforms. because these plugins are expected to be used for a longer time than other standard transforms.

@JLHwung JLHwung force-pushed the use-chrome-data-when-android-is-absent branch from 064852f to 3a6d351 Compare December 30, 2019 02:43
@JLHwung JLHwung force-pushed the use-chrome-data-when-android-is-absent branch from 8f34d63 to 24803c0 Compare December 30, 2019 15:26
Using targets:
{
"android": "77",
"chrome": "77",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recently the chrome 49 usage just drops to 0.5% and therefore excluded from browserslists defaults > 0.5% now.

@JLHwung JLHwung merged commit 03d163a into babel:master Jan 3, 2020
@JLHwung JLHwung deleted the use-chrome-data-when-android-is-absent branch January 3, 2020 23:26
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Apr 4, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: preset-env PR: Bug Fix 🐛 A type of pull request used for our changelog categories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Preset-env loads unnecessary polyfills for Android >= 52
4 participants