Socket
Socket
Sign inDemoInstall

browserslist

Package Overview
Dependencies
6
Maintainers
1
Versions
188
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

browserslist

Share target browsers between different front-end tools, like Autoprefixer, Stylelint and babel-env-preset


Version published
Maintainers
1
Weekly downloads
46,277,816
decreased by-6.75%

Weekly downloads

Package description

What is browserslist?

The browserslist npm package is used to share target browsers and Node.js versions between different front-end tools, like Autoprefixer, Babel, and others. It utilizes a configuration file or package.json entries to specify the range of browser versions that your project supports. It helps in making decisions for transpiling JavaScript, adding vendor prefixes to CSS, and even defining which browser versions to test during the development process.

What are browserslist's main functionalities?

Defining target browsers

This feature allows you to define a range of browsers your project supports by specifying queries like market share, last versions, or excluding certain browsers. The code sample would typically be placed in a package.json file.

"browserslist": ["> 1%", "last 2 versions", "not dead"]

Integration with build tools

Browserslist can be integrated with build tools like Webpack, Babel, or PostCSS to automatically apply browser-specific transformations based on the defined browser support criteria.

const browserslist = require('browserslist');
const supportedBrowsers = browserslist('> 0.5%, last 2 versions, Firefox ESR, not dead');

CLI Usage

Browserslist provides a command-line interface (CLI) that can be used to check which browsers and versions are selected by your queries.

npx browserslist "> 1%, last 2 versions"

Configuring environments

You can define different sets of browsers for various environments, like production or development, within a .browserslistrc file.

[production]
> 1% in US
[development]
last 1 chrome version

Other packages similar to browserslist

Readme

Source

Browserslist Cult Of Martians

Browserslist logo by Anton Lovchikov

The config to share target browsers and Node.js versions between different front-end tools. It is used in:

All tools will find target browsers automatically, when you add the following to package.json:

  "browserslist": [
    "defaults",
    "not IE 11",
    "maintained node versions"
  ]

Or in .browserslistrc config:

# Browsers that we support

defaults
not IE 11
maintained node versions

Developers set their version lists using queries like last 2 versions to be free from updating versions manually. Browserslist will use caniuse-lite with Can I Use data for this queries.

Browserslist will take queries from tool option, browserslist config, .browserslistrc config, browserslist section in package.json or environment variables.

Sponsored by Evil Martians

Docs

Read full docs on GitHub.

Keywords

FAQs

Last updated on 21 Jun 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc