How to generate a browserslist scope to match feature support?

343 views Asked by At

I want to transpile a service worker source file so that it will work on browsers that support service workers. I can't use browserslist directly, because the scope does not accept a list of features to support. Caniuse can tell me which browsers support service workers, so is it just a case of manually listing the browsers in the scope like this?

"browserslist": [
  "Edge >= 17",
  "Firefox >= 44",
  "Chrome >= 45",
  "Safari >= 11.1",
  "Opera >= 32",
  "ios_saf > 11.3",
  "and_chr >= 84",
  "and_uc >= 12.12",
  "Samsung >= 4"
]

https://caniuse.com/#feat=serviceworkers

1

There are 1 answers

0
cascading-jox On

I am not sure what you mean by "I can't use browserslist directly, because the scope does not accept a list of features to support.". Which "scope" do you mean? It is supported to query browser features directly.

Example browserslist query for service workers: supports serviceworkers.