# esbuild-plugin-browserslist

> Configure esbuild's target based on a browserslist query

Latest version **4.0.0** (published 2026-05-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install esbuild-plugin-browserslist
pnpm add esbuild-plugin-browserslist
yarn add esbuild-plugin-browserslist
bun add esbuild-plugin-browserslist
```

## Health

**Score 60/100 (C)** — status: stable.

Positive: esm support; no vulnerabilities; has provenance; high maintenance score.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 4.0.0 |
| Published | 2026-05-06 |
| First published | 2021-04-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | ^22.12.0 \|\| >=24.0.0 |
| Dependencies | 2 |
| Unpacked size | 16.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 51 |
| Author | Nihal Gonsalves <nihal@nihalgonsalves.com> |
| Maintainers | nihalgonsalves |

## Links

- npm: https://www.npmjs.com/package/esbuild-plugin-browserslist
- Repository: https://github.com/nihalgonsalves/esbuild-plugin-browserslist
- npm.io page: https://npm.io/package/esbuild-plugin-browserslist

## Dependencies (2)

- [zod](https://npm.io/package/zod.md) ^4.4.3
- [debug](https://npm.io/package/debug.md) ^4.4.3

## Recent versions

- 4.0.0 (latest) — 2026-05-06
- 3.0.2 — 2026-04-16
- 2.0.0 — 2025-11-11
- 1.0.2 — 2025-10-15
- 1.0.1 — 2025-05-20
- 1.0.0 — 2025-03-19
- 0.16.0 — 2025-02-10
- 0.15.0 — 2024-10-01
- 0.14.0 — 2024-07-08
- 0.13.0 — 2024-07-02
- 0.12.1 — 2024-06-04
- 0.12.0 — 2024-05-22
- 0.11.1 — 2024-01-28
- 0.10.0 — 2023-10-23
- 0.9.1 — 2023-10-05
- … 30 more at https://npm.io/package/esbuild-plugin-browserslist/versions

## README

# esbuild-plugin-browserslist

![build status](https://github.com/nihalgonsalves/esbuild-plugin-browserslist/workflows/build/badge.svg)

Configure [esbuild](https://github.com/evanw/esbuild)'s target based on a [browserslist](https://github.com/browserslist/browserslist) query

## Installation

```sh
npm install --save-dev esbuild-plugin-browserslist esbuild browserslist
```

## Usage

```ts
import esbuild from "esbuild";
import browserslist from "browserslist";
import { esbuildPluginBrowserslist, resolveToEsbuildTarget } from "esbuild-plugin-browserslist";

await esbuild.build({
  entryPoints: ["./foo/bar.ts"],
  // ... other options (except `target`) ...
  plugins: [
    esbuildPluginBrowserslist(browserslist("defaults"), {
      printUnknownTargets: false,
    }),
  ],
});

// Or:

const target = resolveToEsbuildTarget(browserslist("defaults"), {
  printUnknownTargets: false,
});

await esbuild.build({
  entryPoints: ["./foo/bar.ts"],
  target,
});
```

<details>
<summary>:information_source: CJS usage instructions</summary>

Adjust the imports as follows:

```ts
const esbuild = require("esbuild");
const browserslist = require("browserslist");
const {
  esbuildPluginBrowserslist,
  resolveToEsbuildTarget,
} = require("esbuild-plugin-browserslist");
```

</details>

## Caveats

- Only `edge`, `firefox`, `chrome`, `safari`, `ios_saf`, and `node` have direct equivalents for esbuild targets.
- `android` and `and_chr` are mapped to the `chrome` target, and `and_ff` is mapped to the `firefox` target.
- All other browsers are ignored (`and_qq`, `samsung`, `opera`, `op_mini`, `op_mob`, `ie`, `ie_mob`, `bb`, `baidu`, and `kaios`)

## Debugging

You can turn on debug logs (which will print all resolutions or failures) using `DEBUG=esbuild-plugin-browserslist`

---
_Source: https://npm.io/package/esbuild-plugin-browserslist · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
