Skip to main content

index

Interfaces

CompilerOptions

Properties

PropertyTypeDefault valueDescription

dist

string

undefined

The output directory

Example

dist: "dist";

src

string | string[]

undefined

The source file or files to compile

Example

src: "src/index.ts";

bundleDeps?

boolean

false;

If true the bundle will also include all dependencies

bundleWorkspaces?

boolean

true; // in watch mode

If true the bundle will also include all workspace dependencies.

cjsGlobals?

boolean

false;

Adds CommonJS global variables within esm bundle like:

  • __dirname - Corresponds to the directory of the generated bundle file
  • __filename - Corresponds to the file path of the generated bundle file
  • require - Corresponds to the Node.js synchronous function to import modules

esbuild?

Partial<Omit<BuildOptions, "outdir" | "entryPoints">>

undefined

Options to pass to esbuild


HooksOptions

Properties

PropertyType

onBuildEnd

(buildTime: number, warnings: string[], errors: string[]) => void | Promise<void>

onBuildStart

(startTime: number) => void | Promise<void>

Functions

build()

build(options): Promise<void>

Parameters

ParameterType

options

CompilerOptions

Returns

Promise<void>


buildAndWatch()

buildAndWatch(options): Promise<BuildContext<BuildOptions>>

Parameters

ParameterType

options

CompilerOptions

Returns

Promise<BuildContext<BuildOptions>>


bundleFile()

bundleFile(fileName): Promise<{ code: string; dependencies: string[]; }>

Parameters

ParameterType

fileName

string

Returns

Promise<{ code: string; dependencies: string[]; }>


createEsbuildCliHooksPlugin()

createEsbuildCliHooksPlugin(options): Plugin

Parameters

ParameterType

options

HooksOptions

Returns

Plugin