Skip to main content
The PackagerOptions interface defines options for creating and configuring a Packager instance. Source: packages/app-builder-lib/src/packagerApi.ts:9

Interface Definition

Properties

Target Configuration

Map<Platform, Map<Arch, Array<string>>>
Target configuration map. Use Platform.createTarget() or createTargets() to create this structure.Example:
Array<string>
Array of macOS target names. Alternative to using targets.Example:
Supported targets:
  • dmg - DMG installer
  • zip - ZIP archive
  • pkg - PKG installer
  • mas - Mac App Store
  • mas-dev - Mac App Store (development)
Array<string>
Array of Windows target names. Alternative to using targets.Example:
Supported targets:
  • nsis - NSIS installer
  • nsis-web - NSIS web installer
  • portable - Portable executable
  • appx - AppX package (Windows Store)
  • msi - MSI installer
  • squirrel - Squirrel.Windows
  • dir - Unpacked directory
Array<string>
Array of Linux target names. Alternative to using targets.Example:
Supported targets:
  • AppImage - AppImage package
  • snap - Snap package
  • deb - Debian package
  • rpm - RPM package
  • pacman - Pacman package
  • flatpak - Flatpak package
  • dir - Unpacked directory

Project Configuration

string | null
The path to the project directory. Defaults to the current working directory.Example:
Configuration | string | null
The build configuration. Can be:
  • Configuration object
  • Path to configuration file (JSON, YAML, JS, or TS)
  • null to use default configuration from package.json
Example (object):
Example (path):

Advanced Options

((info: Packager, platform: Platform) => PlatformPackager<any>) | null
Factory function to create custom platform packagers. For advanced use cases only.Example:
(options: any) => Promise<boolean>
Hook called when effective options are computed. Return false to skip the platform. For internal use.
string | null
The path to a prepackaged app directory. When specified, electron-builder will skip the packaging step and only create distributable formats.Useful for:
  • Packaging already-built apps
  • Separating build and packaging steps
  • Custom build pipelines
Example:

Usage Examples

Basic Usage

Using Target Map

Multiple Platforms

Custom Project Directory

Packaging Prebuilt App

TypeScript Example

Combined with PublishOptions

When calling build(), you can combine PackagerOptions with PublishOptions:

See Also