Closed xiaoxiangmoe closed 16 hours ago
Browserslist is a config with target browsers for the project. You can use this config to find what polyfills you have to add. For instance, you can avoid adding polyfills if target browsers don’t need it.
Browserslist is a very popular config. It already used by Autoprefixer, Babel, webpack, postcss-preset-env. CRA adds it by default.
Hi @ai,
You can open an issue and mention me, I will add extra details.
Please, provide me with the list of information required to create a .browserslistrc
. A link to a .browserslistrc
for project like njs would help.
Browserslist is a library with Can I Use data, which automatically look and parse config to get target browsers from end-users queries like last 2 versions
.
We have a JS library and Rust.
@ai Is there any tutorial for providing Can I Use data?
Should we provide data by creating a PR to https://github.com/Fyrd/caniuse repo?
It depends on your programming language and environment.
I am using Can I Use data from caniuse-lite
npm package.
FYI, If you need browserslist just to configure the Babel transpiler, you can use babel-preset-njs instead. This doesn’t deal with polyfills though.
@jirutka But some other tool like swc need using .browserslistrc
see https://github.com/browserslist/browserslist/issues/733#issuecomment-1263422707
browserslist need your help to add njs runtime js compliance information to some database like browserslist-db.