Bundle
Creates and manages bundled JavaScript/TypeScript files using esbuild. Supports various output formats, sourcemaps, and platform targets.Properties
Entry point for the bundle. Path to the source file to bundle (e.g., “src/handler.ts”).
Output directory for the bundle. Directory where the bundled file will be written.
Output filename for the bundle. Full path to the output file, overrides outdir if specified.
Bundle format:
iife: Immediately Invoked Function Expressioncjs: CommonJSesm: ECMAScript Modules
Target environment. Examples: ‘node16’, ‘node18’, ‘es2020’
Whether to minify the output.
Whether to generate sourcemaps:
inline: Include sourcemap in bundleexternal: Generate separate .map fileboth: Generate both inline and external
External packages to exclude from bundle. Array of package names to mark as external.
Platform to target:
browser: Browser environmentnode: Node.js environmentneutral: Platform-agnostic
Returns
Path to the bundled file. Absolute or relative path to the generated bundle.
SHA-256 hash of the bundle contents. Used for cache busting and content verification.
The content of the bundle (the .js or .mjs file).