Update Browserslist DB

1.2.3 · active · verified Wed Apr 22

update-browserslist-db is a dedicated CLI tool designed to keep the `caniuse-lite` database up-to-date, which is crucial for modern front-end development workflows. Many build tools and development processes rely on Browserslist configurations (e.g., `last 2 versions`, `>1%`) to target specific browser features. These queries, in turn, depend on accurate and current data from `caniuse-lite`. This package ensures that the underlying browser compatibility data is refreshed, preventing stale targets and potential mismatches in transpilation or polyfilling. The current stable version is 1.2.3, with an active release cadence addressing compatibility across different package managers (npm, pnpm, yarn) and runtimes (Node.js, Bun). Its key differentiator is being the official, single-purpose tool for this specific and vital maintenance task within the Browserslist ecosystem, often run as a postinstall script or via a manual `npx` command.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates how to execute the `update-browserslist-db` CLI tool using `npx`, `pnpm exec`, and `yarn dlx` to refresh `caniuse-lite` and Baseline browser support data, including a common `postinstall` script usage.

/*
This CLI tool is typically run in your project's root directory to update the 'caniuse-lite' data.
It is often included as a 'postinstall' script in package.json or run manually when browser support data needs refreshing.
*/

console.log("Updating caniuse-lite and Baseline data...");

// 1. Using npx (Node.js/npm - recommended for one-off or scripts)
//    npx automatically installs the package if not found and runs it.
//    Command to run in your terminal:
//    npx update-browserslist-db@latest

// 2. If using pnpm
//    Command to run in your terminal:
//    pnpm exec update-browserslist-db latest

// 3. If using yarn
//    Command to run in your terminal:
//    yarn dlx update-browserslist-db@latest

// Example of how to add it to package.json scripts:
/*
{
  "name": "my-project",
  "version": "1.0.0",
  "scripts": {
    "postinstall": "update-browserslist-db"
  },
  "peerDependencies": {
    "browserslist": ">=4.21.0"
  }
}
*/

view raw JSON →