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
Target configuration map. Use
Platform.createTarget() or createTargets() to create this structure.Example:Array of macOS target names. Alternative to using Supported targets:
targets.Example:dmg- DMG installerzip- ZIP archivepkg- PKG installermas- Mac App Storemas-dev- Mac App Store (development)
Array of Windows target names. Alternative to using Supported targets:
targets.Example:nsis- NSIS installernsis-web- NSIS web installerportable- Portable executableappx- AppX package (Windows Store)msi- MSI installersquirrel- Squirrel.Windowsdir- Unpacked directory
Array of Linux target names. Alternative to using Supported targets:
targets.Example:AppImage- AppImage packagesnap- Snap packagedeb- Debian packagerpm- RPM packagepacman- Pacman packageflatpak- Flatpak packagedir- Unpacked directory
Project Configuration
The path to the project directory. Defaults to the current working directory.Example:
The build configuration. Can be:Example (path):
- Configuration object
- Path to configuration file (JSON, YAML, JS, or TS)
nullto use default configuration from package.json
Advanced Options
Factory function to create custom platform packagers. For advanced use cases only.Example:
Hook called when effective options are computed. Return
false to skip the platform. For internal use.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
Usage Examples
Basic Usage
Using Target Map
Multiple Platforms
Custom Project Directory
Packaging Prebuilt App
TypeScript Example
Combined with PublishOptions
When callingbuild(), you can combine PackagerOptions with PublishOptions: