Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

browserslist-load-config

Package Overview
Dependencies
Maintainers
0
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

browserslist-load-config

<img src="https://img.shields.io/badge/Lice

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

browserslist-load-config

npm version license downloads

Introduction

This package is a fork of browserslist.loadConfig with some modifications to make it faster.

Compare to browserslist, this package has the following improvements and differences:

  • 27 times smaller bundle size
  • 140 times smaller install size.
  • Zero dependencies.
  • Written in TypeScript.
  • Smaller and faster.
  • Does not support env variables.

See bundlephobia - browserslist-load-config vs bundlephobia - browserslist for bundle size comparison.

See packagephobia - browserslist-load-config vs packagephobia - browserslist for install size comparison.

Credits

Thanks Andrey Sitnik for creating the Browserslist which is under MIT License.

Usage

Install:

npm add browserslist-load-config -D

loadConfig

import { loadConfig } from "browserslist-load-config";

// Pass a path to the configuration file
const config = loadConfig({
  /**
   * Specify the directory where the configuration file is located
   */
  path: "./path/to/project/root",

  /**
   * Specify the environment to load
   * @default "production"
   */
  env: "production",
});

// Pass a browserslist config directly
const config = loadConfig({
  /**
   * Specify the directory where the configuration file is located
   */
  path: "./path/to/project/root",

  /**
   * Specify the environment to load
   * @default "production"
   */
  env: "production",
});

console.log(config);
/**
 * [
 *   // browserslist config
 * ]
 */

If both config and path are provided, config will be used.

findConfig

import { findConfig } from "browserslist-load-config";

const config = findConfig("./path/to/project/root");

console.log(config);
/**
 * {
 *   defaults: [
 *     // default browserslist config
 *   ],
 *   development: [
 *     // development browserslist config
 *   ],
 *   production: [
 *     // production browserslist config
 *   ],
 * }
 */

License

MIT.

FAQs

Package last updated on 08 Nov 2024

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc