Browserslist: target usage, not versions
July 2024 update: I no longer feel this is a good approach; instead, don’t specify anything to use the Browserslist defaults
keyword, or augment the defaults
keyword with additional queries instead of relying on just a minimum percentage or last few versions.
The
">0.25%"
value tells [Browserslist] to only [target] browsers that make up more than 0.25% of global usage. This ensures your bundle does not contain unnecessary transpiled code for browsers that are used by a very small percentage of users.In most cases, this is a better approach than using […] the
"last 2 versions"
value[, which targets] the last two versions of every browser, which means support is provided for discontinued browsers such as Internet Explorer. This can unnecessarily increase the size of your bundle if you do not expect these browsers to be used to access your application.Ultimately, you should select the appropriate combination of queries to only target browsers that fit your needs.