Socket
Socket
Sign inDemoInstall

esbuild-plugin-browserslist

Package Overview
Dependencies
34
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    esbuild-plugin-browserslist

Configure esbuild's target based on a browserslist query


Version published
Maintainers
1
Created

Changelog

Source

0.12.1 (2024-06-04)

Bug Fixes

  • deps: bump the all group with 4 updates (#190) (a5380a6)

Readme

Source

esbuild-plugin-browserslist

build status

Configure esbuild's target based on a browserslist query

Installation

yarn add esbuild-plugin-browserslist esbuild browserslist

Usage

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,
});
:information_source: CJS usage instructions

Adjust the imports as follows:

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

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

FAQs

Last updated on 04 Jun 2024

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