fix(es/preset-env): Enable "mobile to desktop" (#2907)

This commit is contained in:
Pig Fang 2021-11-29 18:29:49 +08:00 committed by GitHub
parent 756a9bad6a
commit 5a68a360b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 48 additions and 8 deletions

View File

@ -590,14 +590,18 @@ impl Query {
where
T: AsRef<str>,
{
let distribs =
browserslist::resolve(s, browserslist::Opts::new().ignore_unknown_versions(true))
.with_context(|| {
format!(
"failed to resolve browserslist query: {:?}",
s.iter().map(|v| v.as_ref()).collect::<Vec<_>>()
)
})?;
let distribs = browserslist::resolve(
s,
browserslist::Opts::new()
.mobile_to_desktop(true)
.ignore_unknown_versions(true),
)
.with_context(|| {
format!(
"failed to resolve browserslist query: {:?}",
s.iter().map(|v| v.as_ref()).collect::<Vec<_>>()
)
})?;
let versions =
BrowserData::parse_versions(distribs).expect("failed to parse browser version");

View File

@ -1,3 +1,13 @@
import "core-js/modules/es6.array.sort";
import "core-js/modules/es7.array.flat-map";
import "core-js/modules/es7.object.define-getter";
import "core-js/modules/es7.object.define-setter";
import "core-js/modules/es7.object.lookup-getter";
import "core-js/modules/es7.object.lookup-setter";
import "core-js/modules/es7.promise.finally";
import "core-js/modules/es7.string.trim-left";
import "core-js/modules/es7.string.trim-right";
import "core-js/modules/es7.symbol.async-iterator";
import "core-js/modules/web.dom.iterable";
import "core-js/modules/web.immediate";
import "core-js/modules/web.timers";

View File

@ -1,2 +1,28 @@
import "core-js/modules/es.array.flat";
import "core-js/modules/es.array.flat-map";
import "core-js/modules/es.array.iterator";
import "core-js/modules/es.array.reduce";
import "core-js/modules/es.array.reduce-right";
import "core-js/modules/es.array.sort";
import "core-js/modules/es.array.unscopables.flat";
import "core-js/modules/es.array.unscopables.flat-map";
import "core-js/modules/es.math.hypot";
import "core-js/modules/es.object.define-getter";
import "core-js/modules/es.object.define-setter";
import "core-js/modules/es.object.from-entries";
import "core-js/modules/es.object.lookup-getter";
import "core-js/modules/es.object.lookup-setter";
import "core-js/modules/es.promise";
import "core-js/modules/es.promise.finally";
import "core-js/modules/es.string.replace";
import "core-js/modules/es.string.trim-end";
import "core-js/modules/es.string.trim-start";
import "core-js/modules/es.symbol.async-iterator";
import "core-js/modules/es.symbol.description";
import "core-js/modules/web.dom-collections.iterator";
import "core-js/modules/web.immediate";
import "core-js/modules/web.queue-microtask";
import "core-js/modules/web.url";
import "core-js/modules/web.url-search-params";
import "core-js/modules/web.url.to-json";
1 ** 2;