ESBuild Builder
Build GitHub Actions using ESBuild.
Installation
bash
pnpm add -D actions-kit @actions-sdk/esbuild-builderbash
yarn add -D actions-kit @actions-sdk/esbuild-builderbash
npm install -D actions-kit @actions-sdk/esbuild-builderbash
bun install -D actions-kit @actions-sdk/esbuild-builderSet the builder in your actions-kit.config.ts file:
ts
import esbuild from "@actions-sdk/esbuild-builder";
import { defineConfig } from "actions-kit/config";
export default defineConfig({
builder: esbuild({
...esbuildOptions,
}),
});Customizing ESBuild
You can customize the ESBuild options by passing the options directly into the esbuild function.
NOTE
Not all of ESBuild's options are supported. For a list of the supported options, see ESBuild Options.
ts
import esbuild from "@actions-sdk/esbuild-builder";
import { defineConfig } from "actions-kit/config";
export default defineConfig({
builder: esbuild({
target: "esnext",
format: "esm",
minify: true,
}),
});ESBuild Options
These are the supported ESBuild options:
| Option | Type | Documentation |
|---|---|---|
| sourcemap | boolean | 'linked' | 'inline' | 'external' | 'both' | Source Map |
| legalComments | 'none' | 'inline' | 'eof' | 'linked' | 'external' | Legal Comments |
| sourceRoot | string | Source Root |
| sourcesContent | boolean | Sources Content |
| format | 'iife' | 'cjs' | 'esm' | Format |
| globalName | string | Global Name |
| target | string | string[] | Target |
| supported | Record<string, boolean> | Supported |
| platform | 'browser' | 'node' | 'neutral' | Platform |
| mangleProps | RegExp | Mangle Props |
| reserveProps | RegExp | Mangle Props |
| mangleQuoted | boolean | Mangle Props |
| mangleCache | Record<string, string | false> | Mangle Props |
| drop | ('console' | 'debugger')[] | Drop |
| dropLabels | string[] | Drop Labels |
| minify | boolean | Minify |
| minifyWhitespace | boolean | Minify |
| minifyIdentifiers | boolean | Minify |
| minifySyntax | boolean | Minify |
| lineLimit | number | Line Limit |
| charset | 'ascii' | 'utf8' | Charset |
| treeShaking | boolean | Tree Shaking |
| ignoreAnnotations | boolean | Ignore Annotations |
| jsx | 'transform' | 'preserve' | 'automatic' | JSX |
| jsxFactory | string | JSX Factory |
| jsxFragment | string | JSX Fragment |
| jsxImportSource | string | JSX Import Source |
| jsxDev | boolean | JSX Development |
| jsxSideEffects | boolean | JSX Side Effects |
| define | { [key: string]: string } | Define |
| pure | string[] | Pure |
| keepNames | boolean | Keep Names |
| color | boolean | Color |
| logLevel | 'verbose' | 'debug' | 'info' | 'warning' | 'error' | 'silent' | Log Level |
| logLimit | number | Log Limit |
| logOverride | Record<string, LogLevel> | Log Override |
| bundle | boolean | Bundle |
| splitting | boolean | Splitting |
| preserveSymlinks | boolean | Preserve Symlinks |
| outfile | string | Outfile |
| metafile | boolean | Metafile |
| outdir | string | Outdir |
| outbase | string | Outbase |
| external | string[] | External |
| packages | 'bundle' | 'external' | Packages |
| alias | Record<string, string> | Alias |
| loader | { [ext: string]: Loader } | Loader |
| resolveExtensions | string[] | Resolve Extensions |
| mainFields | string[] | Main Fields |
| conditions | string[] | Conditions |
| write | boolean | Write |
| allowOverwrite | boolean | Allow Overwrite |
| tsconfig | string | TSConfig |
| outExtension | { [ext: string]: string } | Out Extension |
| publicPath | string | Public Path |
| entryNames | string | Entry Names |
| chunkNames | string | Chunk Names |
| assetNames | string | Asset Names |
| inject | string[] | Inject |
| banner | { [type: string]: string } | Banner |
| footer | { [type: string]: string } | Footer |
| entryPoints | string[] | Record<string, string> | { in: string, out: string }[] | Entry Points |
| plugins | Plugin[] | Plugins |
| absWorkingDir | string | Working Directory |
| nodePaths | string[] | Node Paths |