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
[preset-env] Android not supporting anything? #8351
Comments
Hey @luzat! We really appreciate you taking the time to report an issue. The collaborators If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack |
Hmm, not sure as compat-table only has explicit handling of android <= 4.4.3, and removed the Chrome aliases for a while now: compat-table/compat-table#1104 My initial reaction is I'd rather keep it (relatively) simple and consistent with our data source (compat-table), and ask users to use We should do better about documenting this, for sure! EDIT: Maybe if we get a target of android >4 we can show a message to use Chrome instead? |
It is very non-intuitive if specifying Android as a platform includes all plugins/transforms without explanation. Also, other tools might require Android to be in the browser list, which would lead to maintaining multiple lists for different tools. There is already special code for Opera and Electron, too, which could be removed with the same reasoning. Looking at the version history it seems that after 4.4, starting with Chrome 18, the same engine has always been used. The code next to Opera's and Electron's code can probably be easily extended (the check for // add android
if (!plugin.android && plugin.chrome >= 18) {
plugin.android = plugin.chrome;
} Untested; but it looks as if this could suffice? |
I guess I view |
I need to think a bit about this. caniuse knows about Android browsers <=4.4 and Android 67 (with global usage of 0), which I think are encoded as "android". Chrome for Android should be encoded as This may be a bug in some of the other components (browserslist?) which my repository above can be used for to reproduce. Basically, a query to browserslist with |
I have to correct myself: "last 1 version" introduces android 67, but also includes and_chr 67. caniuse always (at least for some time) adds the current Chrome for Android browser as the current Chromium version with usage equal to 0: "Starting in Android 5, the web engine can be updated separately, so the latest Chromium version number is used instead." That's of course a bit weird, but this shouldn't be passed onto users of preset-env. Given that browserslist recommends to include "last 1 version" in its "Best Practices", this means that most users will get "android 67" included and in turn most transforms (often without noticing). Given that Chromium x should support the same features as Chrome for Android x from what I know, the patch still seems to make sense versus requiring all users who use a recommended configuration to read a notice and exclude a browser which would in reality support those features. The point of preset-env is mostly interpreting mapping browser data to features, which is why I think this belongs to its core functionality and not into a user's configuration. I also don't think one could convince caniuse or browserslist to change their behavior in that case given the number of dependencies they have (and how data is used on caniuse.com). Explaining why people need "not android > 0" (or >= 5/>=18) feels more weird to me than mapping/copying android >=18 to chrome, but I'll leave it at that. |
I just faced this issue as well. If I add |
This is especially problematic because the browserslist defaults include Android 67: $ npx browserslist defaults | grep -i android
android 67
android 4.4.3-4.4.4 |
Any updates on this? browserslist defaults still returns android 76, preset-env with debug enabled reports "android": "4" and compiles all to ES5.
|
This issue has been fixed in #10814, please update |
Bug Report
The preset seems to think that Android does not support anything and enables every plugin because of
"android": "67"
support. Chrome for Android should support most features in that version.I set up an example repository with basic configuration and debug enabled. Output after
npm install
/yarn install
andnpm run demo
/yarn run demo
is:I would expect the Android browser to support most if not all of these. I guess there is a mapping from Android to the equivalent Chrome versions missing at some point (compat-table, caniuse, browserslist?) and I recall having used Babel 7 previously without this behavior. I imagine some third-party library update to be responsible.
babel.config.js
I am not sure if the feature sets of Android x and Chrome x are equivalent starting with some version of if there are numbering and feature differences to account for, but probably either compat-table or preset-env should have some mapping., most likely for all versions of Android >4.4.
Environment
The text was updated successfully, but these errors were encountered: