Feature Request
Is your feature request related to a problem? Please describe.
@babel/preset-env only uses Android, Chrome, Edge, Firefox, IE, iOS, Safari, Node versions for detecting which transforms to include:
|
const browserNameMap = { |
|
android: "android", |
|
chrome: "chrome", |
|
and_chr: "chrome", |
|
edge: "edge", |
|
firefox: "firefox", |
|
ie: "ie", |
|
ios_saf: "ios", |
|
safari: "safari", |
|
node: "node", |
|
}; |
and silently ignores other browsers:
|
const normalizedBrowserName = browserNameMap[browserName]; |
|
|
|
if (!normalizedBrowserName) { |
|
return all; |
|
} |
However, there are local-popular or manufacturer-specific browsers such as Opera Mini, UC browser, QQ browser, Baidu browser, and Samsung Internet. Please see browserslist/browserslist#250 for their importance.
In Browserslist default, fortunately, IE 11, Chrome 49 (usage 0.69%) and Android 4.x (4.4 usage 0.58%, 4.4.4 isn't strictly last 2 versions) acts as a stopgap preventing from excluding transform needed for old browsers. However, if user excludes them, they become dead, or their usage drops, preset-env will recognize as if it targets very modern browsers. Also, user may explicitly target them, using Browserslist config.
Describe the solution you'd like
Warn users about unused (unsupported, those preset-env doesn't have data) browsers like:
Following browser(s) were selected by Browserslist,
but @babel/preset-env doesn't know about their features.
Please add plugins and built-ins manually, if needed:
{
"baidu": "7.12",
"samsung": "7",
}
at least on DEBUG mode.
Then, the user can add necessary plugins and built-ins manually, or update Browserslist to exclude them.
Describe alternatives you've considered
For Chromium-based browsers (UC, QQ, Baidu, Samsung), we can use a mapping to Chromium versions, like electron-to-chromium. I've opened an issue at browserslist/browserslist#290. I'll open an issue here, if it gets rejected. #8552.
Teachability, Documentation, Adoption, Migration Strategy
See above
Feature Request
Is your feature request related to a problem? Please describe.
@babel/preset-envonly usesAndroid,Chrome,Edge,Firefox,IE,iOS,Safari,Nodeversions for detecting which transforms to include:babel/packages/babel-preset-env/src/targets-parser.js
Lines 32 to 42 in e875fc7
and silently ignores other browsers:
babel/packages/babel-preset-env/src/targets-parser.js
Lines 72 to 76 in e875fc7
However, there are local-popular or manufacturer-specific browsers such as Opera Mini, UC browser, QQ browser, Baidu browser, and Samsung Internet. Please see browserslist/browserslist#250 for their importance.
In Browserslist default, fortunately, IE 11, Chrome 49 (usage 0.69%) and Android 4.x (4.4 usage 0.58%, 4.4.4 isn't strictly last 2 versions) acts as a stopgap preventing from excluding transform needed for old browsers. However, if user excludes them, they become
dead, or their usage drops,preset-envwill recognize as if it targets very modern browsers. Also, user may explicitly target them, using Browserslist config.Describe the solution you'd like
Warn users about unused (unsupported, those
preset-envdoesn't have data) browsers like:at least on
DEBUGmode.Then, the user can add necessary plugins and built-ins manually, or update Browserslist to exclude them.
Describe alternatives you've considered
For Chromium-based browsers (UC, QQ, Baidu, Samsung), we can use a mapping to Chromium versions, like
electron-to-chromium. I've opened an issue at browserslist/browserslist#290.I'll open an issue here, if it gets rejected.#8552.Teachability, Documentation, Adoption, Migration Strategy
See above