
Security News
Socket Integrates With Bun 1.3’s Security Scanner API
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
cosmic-esbuild
Advanced tools
Simplifying esbuild configurations in a familiar way.
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.
npm install cosmic-esbuild
Create a file for your configuration, see the following examples:
{
"bundle": true,
"entryPoints": ["app.js"],
"outdir": "lib",
"sourcemap": "external"
}
bundle: true
entryPoints:
- "app.js"
outdir: "lib"
sourcemap: "external"
bundle = true
entryPoints = [ "app.js" ]
outdir = "lib"
sourcemap = "external"
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"
}
}
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
# 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
.
This work is licensed under The MIT License.
FAQs
Simplifying esbuild configurations in a familiar way
We found that cosmic-esbuild demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
Security News
Python 3.14 adds template strings, deferred annotations, and subinterpreters, plus free-threaded mode, an experimental JIT, and Sigstore verification.
Security News
Former RubyGems maintainers have launched The Gem Cooperative, a new community-run project aimed at rebuilding open governance in the Ruby ecosystem.