Most tools use only major browsers version to detect features. For instance, Babel (babel-preset-env) only uses Android, Chrome, Edge, Firefox, IE, iOS, Safari, Node versions for detecting which transforms to include. (babel/babel/packages/babel-preset-env/src/targets-parser.js#L32-L42).
However, there are local-popular or manufacturer-specific browsers (see #250 for their importance) such as QQ browser, Baidu browser, UC browser, Samsung Internet, which are based on rather old Chromium and rarely update its version:
- QQ: I'm not sure which version
caniuse refers to, but latest version 8.7 is based on 57
- Baidu: 7.12 based on 48, but its user-agent string suggests it may be a WebView wrapper
- UC: 11.8 based on 57
- Samsung: 7 based on 59
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, they'll recognize as if it targets very modern browsers.
Proposal
I think Browserslist should:
- maintain a mapping from their versions to Chromium version, like
electron-to-chromium
- provide a
mapToChromium options which adds or substitutes with corresponding Chrome versions.
For example, browserslist('baidu 7.12', {mapToChromium: true}) returns ['baidu 7.12', 'chrome 48'] or ['chrome 48'].
I'm willing to open a PR.
Alternative
I thought about creating another package for version mappings, but as there are only 7 versions of them caniuse provides, and as there is no reliable source other than user agent strings collected by analytic companies, it needs community contribution. (Only reliable source I can find is Samsung Internet release notes, but even it doesn't have latest versions.)
Most tools use only major browsers version to detect features. For instance, Babel (
babel-preset-env) only usesAndroid,Chrome,Edge,Firefox,IE,iOS,Safari,Nodeversions for detecting which transforms to include. (babel/babel/packages/babel-preset-env/src/targets-parser.js#L32-L42).However, there are local-popular or manufacturer-specific browsers (see #250 for their importance) such as QQ browser, Baidu browser, UC browser, Samsung Internet, which are based on rather old Chromium and rarely update its version:
caniuserefers to, but latest version 8.7 is based on 57Fortunately, 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, they'll recognize as if it targets very modern browsers.Proposal
I think Browserslist should:
electron-to-chromiummapToChromiumoptions which adds or substitutes with corresponding Chrome versions.For example,
browserslist('baidu 7.12', {mapToChromium: true})returns['baidu 7.12', 'chrome 48']or['chrome 48'].I'm willing to open a PR.
Alternative
I thought about creating another package for version mappings, but as there are only 7 versions of them
caniuseprovides, and as there is no reliable source other than user agent strings collected by analytic companies, it needs community contribution. (Only reliable source I can find is Samsung Internet release notes, but even it doesn't have latest versions.)