You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
browserslist conveniently allows for keeping different lists, through different environments. These can be defined in any one of the locations that browserslist searches, such as package.json.
They can then be used by doing e.g.:
browserslist(undefined,{env:'my-env'});
Description of the issue
If the provided environment (my-env, in the example above) isn't defined everywhere, browserslist will return the default list of browsers, rather than providing any sort of indication that the list is missing. This can lead to hard-to-find bugs in client code if for some reason the browserslist configuration isn't present, such as not having been copied to a production environment.
How to reproduce
Run browserslist(undefined, {env:'missing-env'}); without having missing-env defined anywhere
Observe the response
Expected result
An error or an empty list.
Observed result
The default browserslist configuration. In my particular version:
But be ready, that it could take a few months before the next major update.
It is hard to make major releases of Browserslist, since we need to force all tools to switch to new versions (to avoid the case, when different tools parse Browserslist config differently because of different Browserslist version).
Background
browserslist
conveniently allows for keeping different lists, through different environments. These can be defined in any one of the locations thatbrowserslist
searches, such aspackage.json
.They can then be used by doing e.g.:
Description of the issue
If the provided environment (
my-env
, in the example above) isn't defined everywhere,browserslist
will return the default list of browsers, rather than providing any sort of indication that the list is missing. This can lead to hard-to-find bugs in client code if for some reason thebrowserslist
configuration isn't present, such as not having been copied to a production environment.How to reproduce
browserslist(undefined, {env:'missing-env'});
without havingmissing-env
defined anywhereExpected result
An error or an empty list.
Observed result
The default
browserslist
configuration. In my particular version:Next steps
I'm more than happy to work on a PR to fix this issue, but it would likely be best to reach a consensus first on what the correct behaviour should be:
Thank you!
The text was updated successfully, but these errors were encountered: