Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

cosmic-esbuild

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cosmic-esbuild

Simplifying esbuild configurations in a familiar way

latest
Source
npmnpm
Version
0.2.2
Version published
Maintainers
1
Created
Source

cosmic-esbuild

Simplifying esbuild configurations in a familiar way.

License Version: npm GitHub branch check runs

Description

This package allows you to declaratively configure esbuild using the popular cosmiconfig format. No more custom build scripts, no more lengthy build commands in your manifest.

Installation

npm install cosmic-esbuild

Usage

Configuration

Create a file for your configuration, see the following examples:

JSON
{
	"bundle": true,
	"entryPoints": ["app.js"],
	"outdir": "lib",
	"sourcemap": "external"
}
YAML
bundle: true
entryPoints:
  - "app.js"
outdir: "lib"
sourcemap: "external"
TOML
bundle = true
entryPoints = [ "app.js" ]
outdir = "lib"
sourcemap = "external"
TypeScript
import type { BuildOptions } from "esbuild";

const config = {
	bundle: true,
	entryPoints: ["app.js"],
	outdir: "dist",
	sourcemap: "external",
} satisfies BuildOptions;

export default config;
package.json

This is an extended example that also includes possible scripts

{
	"name": "your-package",
	"scripts": {
		"build": "cosmic-esbuild",
		"dev": "cosmic-esbuild --watch"
	},
	"esbuild": {
		"bundle": true,
		"entryPoints": ["app.js"],
		"outdir": "lib",
		"sourcemap": "external"
	}
}

Supported formats

You can write your configuration to any of the following formats (sorted by precedence):

  • package.json (add the esbuild property with your config)
  • .esbuildrc (JSON or YAML)
  • .esbuildrc.json
  • .esbuildrc.jsonc
  • .esbuildrc.yaml
  • .esbuildrc.yml
  • .esbuildrc.toml
  • esbuild.config.json
  • esbuild.config.jsonc
  • esbuild.config.yaml
  • esbuild.config.yml
  • esbuild.config.toml
  • esbuild.config.js
  • esbuild.config.ts
  • esbuild.config.cjs
  • esbuild.config.mjs

CLI

# Build, auto-load config
npx cosmic-esbuild

# Build, specify config
npx cosmic-esbuild --config esbuild.config.ts

# Watch
npx cosmic-esbuild --watch

[!NOTE] The CLI should primarily be used with configuration files. However, some of the basic esbuild options can be passed as command-line arguments. It's not a goal of this project to replicate esbuild's CLI functionality.

For a full list of command-line arguments, run npx cosmic-build --help.

License

This work is licensed under The MIT License.

Keywords

esbuild

FAQs

Package last updated on 07 Oct 2025

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