Skip to main content

snap

The top-level snapcraft key is the recommended way to configure Snap builds. It requires an explicit base field and separates per-core options cleanly.

The flat snap config key was removed in v27 — use snapcraft instead. electron-builder migrate-schema converts an old snap config to snapcraft automatically. See Migrating from snap to snapcraft if you are upgrading.


core24 targets Ubuntu 24.04 Noble and requires Electron 25.0.0+ (28.0.0+ recommended). It uses snapcraft v8 (craft-application framework) and brings first-class Wayland, the GNOME extension, and Launchpad remote builds for multi-arch CI.

{
"snapcraft": {
"base": "core24",
"core24": {
"confinement": "strict"
}
}
}

Building Snap packages requires a Linux environment (or Docker).

Build Environments​

Choose one build environment. They are mutually exclusive.

OptionPlatformRecommended for
useLXD: trueLinuxLinux CI where nested virtualisation is unavailable
useMultipass: truemacOS / Windows / LinuxLocal development
useDestructiveMode: trueLinux onlyDocker CI containers without any virtualisation
remoteBuild.enabled: trueAnyMulti-arch CI (amd64, arm64, armhf) via Launchpad

If none is set and you are on Linux, snapcraft's own default (Multipass) is used. On non-Linux platforms you must choose useMultipass or remoteBuild.

LXD​

Container-based isolation. Preferred on most Linux CI systems because it does not require nested virtualisation (unlike Multipass).

{
"snapcraft": {
"base": "core24",
"core24": {
"useLXD": true
}
}
}

LXD must be installed and the build user must be in the lxd group:

sudo snap install lxd
sudo usermod -aG lxd $USER
lxd init --minimal

Multipass​

VM-based isolation. The default choice for local development on macOS and Windows.

{
"snapcraft": {
"base": "core24",
"core24": {
"useMultipass": true
}
}
}

Destructive Mode​

Builds directly on the host without any VM or container (snapcraft --destructive-mode).

!!! warning Not recommended for production builds. Destructive mode pollutes the host environment — any library present on the host at build time can end up in the snap, making builds difficult to reproduce. Prefer useLXD or useMultipass for clean builds.

Valid reason(s) to use this mode:

  • CI test suites where the environment is already fully controlled.

The gnome extension is incompatible with destructive mode. electron-builder automatically clears extensions when useDestructiveMode is set; explicitly including "gnome" alongside it will throw an error.

{
"snapcraft": {
"base": "core24",
"core24": {
"useDestructiveMode": true,
"extensions": []
}
}
}

Remote Build on Launchpad​

Builds on Canonical's Launchpad infrastructure. Works from any platform and supports building for multiple architectures simultaneously (amd64, arm64, armhf).

{
"snapcraft": {
"base": "core24",
"core24": {
"remoteBuild": {
"enabled": true,
"buildFor": ["amd64", "arm64"],
"acceptPublicUpload": true
}
}
}
}

!!! note Unless privateProject is set, your source code is uploaded to a public Launchpad repository. Set acceptPublicUpload: true to suppress the interactive consent prompt in CI.

Authentication​

Remote builds require Snapcraft Store credentials. electron-builder resolves them in this order:

  1. remoteBuild.cscLink — base64-encoded credentials or a file path in the build config.
  2. SNAP_CSC_LINK — environment variable, same format (CI-recommended).
  3. SNAPCRAFT_STORE_CREDENTIALS — plain-text macaroon, read directly by snapcraft.
  4. An active interactive snapcraft login session.

Credentials are injected only into the spawned snapcraft subprocess environment and are never exposed through process.env.

This follows the same pattern as WIN_CSC_LINK / CSC_LINK for code signing.

CI Setup​

Generate credentials once and store as a CI secret:

# Run locally — output is your CI secret value
snapcraft export-login - | base64 -w0

Then set SNAP_CSC_LINK in your CI environment:

# GitHub Actions
- name: Build and publish snap
env:
SNAP_CSC_LINK: ${{ secrets.SNAP_CSC_LINK }}
run: npx electron-builder --linux snap
Classic Confinement

Snap Store requires manual review and approval for classic confinement. Electron apps typically use strict with appropriate interface plugs.

To reference credentials file directly via the config (useful for monorepos where the credential is managed per-project):

{
"snapcraft": {
"base": "core24",
"core24": {
"remoteBuild": {
"enabled": true,
"cscLink": "file://..."
}
}
}
}

GNOME Extension​

By default, core24 builds apply the gnome extension, which:

  • Pulls in the gnome-46-2404 platform content snap (GTK3, GLib, etc.)
  • Adds gtk-3-themes, icon-themes, sound-themes content snaps
  • Adds the gpu-2404 GPU support content snap
  • Injects layout, environment variables, and plugs required by Electron on Ubuntu 24.04

You normally do not need to configure extensions at all. To opt out:

{
"snapcraft": {
"base": "core24",
"core24": {
"extensions": []
}
}
}

When extensions is empty, electron-builder falls back to the standard Electron plug set and you are responsible for layout and content snap declarations.

Minimal Plugs

Start with only the plugs you actually need. Unnecessary plugs may slow Snap Store review. At minimum, browser-support, network, desktop, and desktop-legacy are needed for most Electron apps.

Plugs​

When plugs is unset, core24 declares browser-support. Without the gnome extension it also declares the app-level desktop plugs (desktop, x11, wayland, home, network, audio-playback, …) and, outside destructive mode, the content-snap plugs the extension would otherwise provide (gnome-46-2404, gtk-3-themes, icon-themes, sound-themes, gpu-2404). Include "default" to add plugs to the full default set (the app-level desktop plugs are always part of it); without "default", your list replaces the defaults:

{
"snapcraft": {
"base": "core24",
"core24": {
"plugs": ["default", "camera", { "home": { "read": "all" } }]
}
}
}

Entries are deduplicated by plug name, and a descriptor object named like a default plug overrides that plug's attributes. A null descriptor resets a default plug named like its interface (browser-support) to the snapd defaults, and removes a default content-snap plug (gtk-3-themes, icon-themes, sound-themes, gnome-46-2404, gpu-2404) from the snap — for example ["default", { "sound-themes": null }]. The default layout binds into gnome-46-2404 and gpu-2404, so set layout as well if you remove either of those.

browser-support is requested without allow-sandbox, so the app is launched with --no-sandbox and chrome-sandbox is left out of the snap; the snap confinement isolates the app. The Snap Store reserves allow-sandbox for vetted publishers and rejects other uploads that request it — electron-builder warns if you configure it.


Wayland​

core24 always allows native Wayland. The snap runs with --ozone-platform=wayland on compositors that support it and falls back to XWayland otherwise.

To force X11-only mode, set forceX11: true:

{
"snapcraft": {
"base": "core24",
"core24": {
"forceX11": true
}
}
}

Stage Packages​

The default stage packages are ["libnspr4", "libnss3", "libxss1", "libappindicator3-1", "libsecret-1-0"].

Use the "default" keyword to extend the defaults rather than replace them:

{
"snapcraft": {
"base": "core24",
"core24": {
"stagePackages": ["default", "libv4l-0"]
}
}
}

Core 22​

core22 targets Ubuntu 22.04 Jammy and is supported via the legacy SnapCoreLegacy implementation. (As of v27, core24 is also stable — prefer it for new apps.)

{
"snapcraft": {
"base": "core22",
"core22": {
"summary": "My Electron app",
"confinement": "strict",
"stagePackages": ["default"]
}
}
}

Key differences from core24:

  • allowNativeWayland defaults to false — Wayland is disabled by default for older Electron compatibility. Set to true to enable. (The legacy interface uses allowNativeWayland; core24 uses forceX11.)
  • No extensions — no GNOME extension support; uses the desktop-gtk2 part instead.
  • useTemplateApp — when stagePackages is not customised, electron-builder uses a pre-built Electron snap template for faster assembly (x64 and armv7l only).
  • Template builds skip snapcraft — the image is packed directly with the mksquashfs from the toolsets.appimage bundle (non-template builds run the snapcraft CLI). compression: "lzo" needs a toolset other than the legacy "0.0.0", whose mksquashfs supports only gzip and xz.

Core 20​

core20 targets Ubuntu 20.04 Focal.

{
"snapcraft": {
"base": "core20",
"core20": {
"summary": "My Electron app",
"confinement": "strict"
}
}
}

Behaviour is identical to core22 above. Use core22 unless the Snap Store requires core20.


Core 18​

core18 targets Ubuntu 18.04 Bionic. Use only if your store listing requires it.

{
"snapcraft": {
"base": "core18",
"core18": {
"summary": "My Electron app",
"confinement": "strict"
}
}
}

Custom Pass-Through​

Set base: "custom" to pass a snapcraft.yaml file (or an inline object) through to snapcraft verbatim. electron-builder performs no injection — no plugs, extensions, organize mappings, or desktop entries are added.

{
"snapcraft": {
"base": "custom",
"custom": {
"yaml": "build/snapcraft.yaml"
}
}
}

The yaml path is resolved relative to the build resources directory (build/ by default). You can also supply the YAML content inline as an object in the config.


Migrating from snap to snapcraft​

Automated

electron-builder migrate-schema performs this restructuring for you. If the old config has no base, it assumes core20 and warns so you can confirm. See v27 Breaking Changes → snap → snapcraft.

The removed snap key is equivalent to using snapcraft with a per-core options object. The base field moves to the top level of snapcraft, and all other fields move inside the corresponding core key.

// Before — deprecated snap key
{
"snap": {
"base": "core22",
"summary": "My app",
"confinement": "strict",
"stagePackages": ["default", "libfoo"]
}
}

// After — snapcraft key (recommended)
{
"snapcraft": {
"base": "core22",
"core22": {
"summary": "My app",
"confinement": "strict",
"stagePackages": ["default", "libfoo"]
}
}
}

For core22 and older, place the per-core options inside the base-named sub-key (e.g. core22). Omit base from the inner object — it lives at snapcraft.base now.

The appPartStage option controls which files are included from the main app part:

snapcraft:
base: core22
core22:
appPartStage:
- -usr/share/doc
- -usr/share/man

Publishing to the Snap Store​

  1. Create an account at snapcraft.io, register your snap name, and install the snapcraft CLI — see Publishing to the Snap Store
  2. Configure publishing in your electron-builder config:
publish:
provider: snapStore
repo: myapp # your registered snap name
channels:
- stable
  1. Build and publish: electron-builder --linux snap --publish always

Channel Strategy​

ChannelPurpose
edgeLatest development builds (auto-published from CI)
betaBeta testing builds
candidateRelease candidates
stableProduction releases

Local Testing​

Install a locally built snap without the Snap Store:

sudo snap install --dangerous dist/myapp_1.0.0_amd64.snap

Run and check logs:

myapp
journalctl --user -xe | grep myapp

To uninstall: sudo snap remove myapp

Debugging​

Enable verbose electron-builder output:

DEBUG=electron-builder electron-builder --linux snap

For snap runtime issues, check confinement denials:

snap run --shell myapp
# Inside the snap shell, test what's accessible

Configuration​

snapcraft (new)​

Interface: SnapcraftOptions

New-style snap configuration. Use this via the snapcraft key in your build config. Selects the snapcraft core version and its per-core options.

Extends​

Properties​

artifactName?​

readonly optional artifactName?: string | null

The artifact file name template.

Inherited from​

TargetSpecificOptions.artifactName


base​

readonly base: "core18" | "core20" | "core22" | "core24" | "custom"

The snap base to use as the execution environment. Determines which set of per-core options (core18, core20, core22, core24, custom) is active.

Only one core may be selected per build target.


core18?​

readonly optional core18?: SnapOptionsLegacy | null

Configuration for a core18 build. Only active when base is "core18".


core20?​

readonly optional core20?: SnapOptionsLegacy | null

Configuration for a core20 build. Only active when base is "core20".


core22?​

readonly optional core22?: SnapOptionsLegacy | null

Configuration for a core22 build. Only active when base is "core22".


core24?​

readonly optional core24?: SnapOptions24 | null

Options for building a core24 snap. Uses the snapcraft CLI directly. Inherits desktop-entry fields from CommonLinuxOptions and publish config from TargetSpecificOptions.


readonly optional cscLink?: string

Snapcraft Store credentials — base64-encoded credentials string or file path. Accepts the same formats as WIN_CSC_LINK / CSC_LINK: base64 data, absolute/relative/~/ file paths, and file:// URIs. Relative paths are resolved against the build resources directory.

Injected as SNAPCRAFT_STORE_CREDENTIALS into every snapcraft subprocess (core18/core20/core22/core24 builds and snapcraft upload). Not applied for base: "custom" — inject credentials manually via environment variables.

The SNAP_CSC_LINK environment variable is the CI-friendly alternative. Generate with: snapcraft export-login - | base64 -w0


custom?​

readonly optional custom?: SnapOptionsCustom | null

Pass-through custom snap configuration. electron-builder will read the snapcraft.yaml at yamlPath and use it verbatim — no plugs, extensions, organize mappings, or desktop files are injected.


publish?​

optional publish?: Publish

Inherited from​

TargetSpecificOptions.publish

SnapOptions24 (core24)​

Interface: SnapOptions24

Options for building a core24 snap. This interface does not extend the legacy SnapBaseOptions — it uses the snapcraft CLI directly.

Fields inherited from CommonLinuxOptions (description, category, mimeTypes, executableArgs, desktop, synopsis) are automatically populated from the root linux.* configuration. You do not need to duplicate them here; values set directly on this interface take precedence over the cascaded linux.* values.

Extends​

Properties​

after?​

readonly optional after?: string[] | null

Names of other snapcraft parts that must be built before the app part.


appPartStage?​

readonly optional appPartStage?: string[] | null

Filesets controlling which files from the app part are staged into the snap. Supports glob patterns and exclusions. See filesets.


artifactName?​

readonly optional artifactName?: string | null

The artifact file name template.

Inherited from​

TargetSpecificOptions.artifactName


assumes?​

readonly optional assumes?: string | string[] | null

Features that must be supported by the host snapd before the snap can be installed. See assumes.


autoStart?​

readonly optional autoStart?: boolean

Whether the app should auto-start on login (creates an autostart desktop entry).

Default​

false

buildPackages?​

readonly optional buildPackages?: string[] | null

Debian packages required at build time (installed inside the build environment).


category?​

readonly optional category?: string | null

The application category.

Inherited from​

CommonLinuxOptions.category


compression?​

readonly optional compression?: "xz" | "lzo" | null

Compression algorithm for the snap SquashFS image.

  • xz — smaller file, slower decompression (recommended for distribution).
  • lzo — larger file, faster decompression (useful for development iteration). Omit to use snapcraft's default (xz).

When not set, linux.compression is mapped automatically: "store" → "lzo", "maximum" → "xz", "normal" → snapcraft default. Explicitly setting this field always overrides the mapped value.


confinement?​

readonly optional confinement?: "strict" | "classic" | "devmode" | null

The type of confinement supported by the snap.

Default​

strict

description?​

readonly optional description?: string | null

As description from application package.json, but allows you to specify different for Linux.

Inherited from​

CommonLinuxOptions.description


desktop?​

readonly optional desktop?: LinuxDesktopFile | null

The Desktop file

Inherited from​

CommonLinuxOptions.desktop


environment?​

readonly optional environment?: {[key: string]: string; } | null

Additional environment variables injected into the snap's runtime environment. Merged with the electron-builder defaults (TMPDIR=$XDG_RUNTIME_DIR). User-supplied values take precedence.


executableArgs?​

readonly optional executableArgs?: string[] | null

The executable parameters. Pass to executableName

Inherited from​

CommonLinuxOptions.executableArgs


extensions?​

readonly optional extensions?: string[] | null

Snapcraft extensions to apply to the app. Defaults to ["gnome"] in normal builds (recommended for Electron apps on Ubuntu 24.04+). Automatically set to [] in useDestructiveMode builds, where the gnome extension is incompatible. Explicitly including "gnome" while useDestructiveMode is set will throw. See: https://documentation.ubuntu.com/snapcraft/stable/reference/extensions/gnome-extension/


forceX11?​

readonly optional forceX11?: boolean | null

Set to true to force X11 by injecting --ozone-platform=x11 into the snap command line. When unset or false, no flag is injected and native Wayland is allowed. Unlike the legacy snap.allowNativeWayland, there is no electron-version-based default here — core24 always allows Wayland unless this is explicitly true.


grade?​

readonly optional grade?: "devel" | "stable" | null

The quality grade of the snap. devel — not publishable to stable/candidate channels. stable — suitable for all channels.

Default​

stable

hooks?​

readonly optional hooks?: string | null

Directory containing snap hooks, relative to the build resources directory.

Default​

build/snap-hooks

layout?​

readonly optional layout?: {[key: string]: object; } | null

Snap layouts — bind-mount or symlink host paths into the snap's namespace. User-provided layouts always override the extension defaults.


mimeTypes?​

readonly optional mimeTypes?: string[] | null

The mime types in addition to specified in the file associations. Use it if you don't want to register a new mime type, but reuse existing.

Inherited from​

CommonLinuxOptions.mimeTypes


plugs?​

readonly optional plugs?: PlugDescriptor | (string | PlugDescriptor)[] | null

Plugs (consumed interfaces) for the app.

When unset, electron-builder declares its default plug set: browser-support (without allow-sandbox, so the app is launched with --no-sandbox), plus — unless the gnome extension supplies them — the app-level plugs ["desktop", "desktop-legacy", "home", "x11", "wayland", "unity7", "network", "gsettings", "audio-playback", "pulseaudio", "opengl"] and, for strict builds that are not host/destructive-mode, the content-snap plugs gtk-3-themes, icon-themes, sound-themes, gnome-46-2404 and gpu-2404.

Include "default" to add to that set instead of replacing it: the result is the full default set (the app-level plugs above plus everything the build flavor declares on its own) together with your other entries, deduplicated by plug name. A descriptor object named like a default plug overrides that plug's attributes. A null descriptor resets a default plug named like its interface (browser-support) to the snapd defaults, and removes a default content-snap plug (gtk-3-themes, icon-themes, sound-themes, gnome-46-2404, gpu-2404) from the snap; the default layout binds into gnome-46-2404 and gpu-2404, so set layout too when removing those. Without "default", the list replaces the defaults entirely.

["default", "camera", { "home": { "read": "all" } }]

Supports descriptor objects for plugs with attributes:

[{ "dot-config-app": { "interface": "personal-files", "write": ["$HOME/.config/app"] } }]

The Snap Store reserves browser-support's allow-sandbox attribute for vetted publishers and rejects other uploads that request it; electron-builder warns when it is set.


publish?​

optional publish?: Publish

Inherited from​

TargetSpecificOptions.publish


remoteBuild?​

readonly optional remoteBuild?: RemoteBuildOptions | null

Configuration for a remote build on Launchpad. Enables cross-architecture builds in CI without native hardware or nested virtualisation. Set remoteBuild.buildFor: ["amd64", "arm64"] to build several architectures in one Launchpad job, or the top-level arch: ["x64", "arm64"] option to spawn a separate job per architecture (the two are mutually exclusive).


slots?​

readonly optional slots?: SlotDescriptor | (string | SlotDescriptor)[] | null

Slots (provided interfaces) for the app. Use for MPRIS, D-Bus services, etc.

Example — expose MPRIS under the Chromium bus name:

[{ "mpris": { "name": "chromium" } }]

stagePackages?​

readonly optional stagePackages?: string[] | null

Ubuntu packages to stage alongside the app (equivalent to depends for deb). Defaults to ["libnspr4", "libnss3", "libxss1", "libappindicator3-1", "libsecret-1-0"]. Supports the "default" keyword to reference the default list: ["default", "my-extra-lib"] appends my-extra-lib to the defaults.


summary?​

readonly optional summary?: string | null

A short summary of the snap (max 78 characters). Defaults to productName.


synopsis?​

readonly optional synopsis?: string | null

The short description.

Inherited from​

CommonLinuxOptions.synopsis


title?​

readonly optional title?: string | null

An optional display title (may contain uppercase letters and spaces). Defaults to productName. See snap format.


useDestructiveMode?​

readonly optional useDestructiveMode?: boolean | null

Build directly on the host without an isolated VM or container (snapcraft --destructive-mode). Equivalent to setting SNAPCRAFT_BUILD_ENVIRONMENT=host.

Not recommended for most use cases. Destructive mode pollutes the host environment and produces builds that are difficult to reproduce — any library or tool present on the host at build time can silently end up in the snap. Prefer useLXD or useMultipass for clean, reproducible builds; use remoteBuild for multi-architecture CI.

Valid reasons to enable this option:

  • Building inside a Docker container where nested virtualisation (LXD / Multipass) is unavailable and a remote Launchpad build is not acceptable.
  • Running test suites in CI where the environment is already fully controlled.

The gnome extension is incompatible with this mode enabled — do not include it in extensions.

See​

https://snapcraft.io/docs/build-options


useLXD?​

readonly optional useLXD?: boolean | null

Use LXD as the isolated build environment. Preferred over Multipass on most Linux CI systems where nested virtualisation is unavailable. Mutually exclusive with useMultipass and useDestructiveMode.


useMultipass?​

readonly optional useMultipass?: boolean | null

Use Multipass as the isolated build environment. Mutually exclusive with useLXD and useDestructiveMode.

RemoteBuildOptions​

Interface: RemoteBuildOptions

Configuration for a remote snap build on Launchpad. Remote builds run on Canonical's infrastructure without requiring native hardware or nested virtualisation.

A single remote build can target one or more architectures. Set buildFor to a string for one arch, or to an array (e.g. ["amd64", "arm64"]) to build several architectures in a single snapcraft remote-build job on Launchpad that emits a separate snap artifact per arch. Alternatively, the top-level arch option (e.g. arch: ["x64", "arm64"]) spawns a separate remote-build job per architecture — do not combine that with a buildFor array (mutually exclusive).

Authentication is resolved in this order:

  1. cscLink config field — base64-encoded credentials or a file path
  2. SNAP_CSC_LINK environment variable — same format as cscLink (CI-recommended; follows the same pattern as WIN_CSC_LINK for Windows code signing)
  3. SNAPCRAFT_STORE_CREDENTIALS environment variable (read directly by snapcraft)
  4. An active interactive snapcraft login session

CI setup (set once as a CI secret):

export SNAP_CSC_LINK=$(snapcraft export-login - | base64 -w0)

The resolved credentials are injected only into the spawned snapcraft subprocess environment and never exposed through process.env.

Properties​

acceptPublicUpload?​

optional acceptPublicUpload?: boolean

Suppress the Launchpad public-upload consent prompt by automatically accepting it. Your source code will be uploaded to a public Launchpad repository. Set to true in CI once you understand the implications.


buildFor?​

optional buildFor?: string | string[]

Target architecture (or architectures) for the remote build.

  • Single string (e.g. "amd64"): one Launchpad job, one output snap.
  • Array (e.g. ["amd64", "arm64"]): one Launchpad job that builds all listed architectures and downloads each resulting snap. All produced snaps are emitted as separate build artifacts.

Using an array here is mutually exclusive with setting arch: ["x64", "arm64"] at the electron-builder top level — the top-level arch option spawns a separate remote-build job per architecture, which would duplicate work.

Examples​

"amd64"
["amd64", "arm64"]

enabled​

enabled: boolean

Whether to enable remote build on Launchpad. Must be set explicitly to true to opt in.


launchpadUsername?​

optional launchpadUsername?: string

Your Launchpad username. Used to select the correct Launchpad account when more than one set of credentials is available.


privateProject?​

optional privateProject?: string

Launchpad project name to use for a private source upload. The project must already exist and you must have write access.


recover?​

optional recover?: boolean

Resume a previously interrupted remote build rather than starting a new one.


strategy?​

optional strategy?: "disable-fallback" | "force-fallback"

Controls whether snapcraft may fall back to a different remote build strategy.

  • "disable-fallback" — always use the primary strategy, fail if unavailable.
  • "force-fallback" — always use the fallback strategy.

timeout?​

optional timeout?: number

Maximum time in seconds to wait for the remote build to complete before aborting. Passed to snapcraft remote-build as --timeout <seconds>.

Example​

1800 // 30 minutes

SnapOptionsCustom​

Interface: SnapOptionsCustom

Properties​

yaml?​

readonly optional yaml?: string | SnapcraftYAML | null

Supports 2 routes:

  • Path to an existing snapcraft.yaml file, relative to buildResourcesDir. electron-builder reads the file and passes it through without modification.
  • A SnapcraftYAML object directly in the configuration. electron-builder uses the object to generate a snapcraft.yaml file, which is then passed through without modification.

SnapOptionsLegacy (core18 / core20 / core22)​

Interface: SnapOptionsLegacy

Desktop-entry and runtime fields shared by all Linux targets and all snap core strategies.

Fields set under linux.* in your build config (i.e. on LinuxConfiguration) are automatically cascaded into each snap core's options by LinuxTargetHelper.getSnapCore(). You do not need to duplicate them under snapcraft.core24.*, snapcraft.core22.*, etc. Per-core values always take precedence when both are set.

Extends​

Properties​

after?​

readonly optional after?: string[] | null

Names of snapcraft parts that must be built before the app part. Defaults to ["desktop-gtk2"].

Use "default" to keep the default and add extras: ["default", "my-helper-part"].


allowNativeWayland?​

readonly optional allowNativeWayland?: boolean | null

Allow the snap to run with native Wayland support (--ozone-platform=wayland). Defaults to false for Electron < 38 (legacy behaviour); true for Electron ≥ 38. Set explicitly to override the version-based default.


appPartStage?​

readonly optional appPartStage?: string[] | null

Filesets controlling which files from the app part are staged into the snap. Supports individual files, directories, globs, globstars, and exclusions (prefix !). See Snapcraft filesets. When not set, the snap template's default stage list is used for legacy bases (core18/core20/core22).


artifactName?​

readonly optional artifactName?: string | null

The artifact file name template.

Inherited from​

TargetSpecificOptions.artifactName


assumes?​

readonly optional assumes?: string | string[] | null

Snapd features that must be present on the host before the snap can be installed.


autoStart?​

readonly optional autoStart?: boolean

Whether the snap should automatically start on login.

Default​

false

buildPackages?​

readonly optional buildPackages?: string[] | null

Debian packages required at build time (installed inside the build environment).


category?​

readonly optional category?: string | null

The application category.

Inherited from​

CommonLinuxOptions.category


compression?​

readonly optional compression?: "xz" | "lzo" | null

Compression algorithm for the snap SquashFS image.

  • xz — smaller file, slower decompression (good for distribution).
  • lzo — larger file, faster decompression (good for development iteration). Omit to use snapcraft's default (xz).

When not set, linux.compression is mapped automatically: "store" → "lzo", "maximum" → "xz", "normal" → snapcraft default. Explicitly setting this field always overrides the mapped value.

Template app builds (useTemplateApp) pack the image with the mksquashfs from the toolsets.appimage bundle. lzo requires a toolset other than the legacy "0.0.0", whose mksquashfs supports only gzip and xz.


confinement?​

readonly optional confinement?: "strict" | "classic" | "devmode" | null

The type of snap confinement.

  • strict — recommended; the snap runs in a fully isolated sandbox.
  • devmode — sandbox violations are logged but not enforced; for development only.
  • classic — no confinement; equivalent to a traditionally packaged application. Requires Snap Store approval before publishing.

Default​

strict

description?​

readonly optional description?: string | null

As description from application package.json, but allows you to specify different for Linux.

Inherited from​

CommonLinuxOptions.description


desktop?​

readonly optional desktop?: LinuxDesktopFile | null

The Desktop file

Inherited from​

CommonLinuxOptions.desktop


environment?​

readonly optional environment?: {[key: string]: string; } | null

Environment variables injected into the snap's runtime environment. Merged with the electron-builder default { TMPDIR: "$XDG_RUNTIME_DIR" }. User-supplied values take precedence.


executableArgs?​

readonly optional executableArgs?: string[] | null

The executable parameters. Pass to executableName

Inherited from​

CommonLinuxOptions.executableArgs


grade?​

readonly optional grade?: "devel" | "stable" | null

The quality grade of the snap.

  • stable — suitable for all channels, including stable and candidate.
  • devel — development snapshot; cannot be promoted to stable or candidate.

Default​

stable

hooks?​

readonly optional hooks?: string | null

Directory containing snap hooks, relative to the build resources directory (build/).

Default​

build/snap-hooks

layout?​

readonly optional layout?: {[key: string]: object; } | null

Snap layouts — bind-mount or symlink host paths into the snap's namespace, making libraries or config at /usr, /var, /etc, etc. accessible inside the confined environment.


mimeTypes?​

readonly optional mimeTypes?: string[] | null

The mime types in addition to specified in the file associations. Use it if you don't want to register a new mime type, but reuse existing.

Inherited from​

CommonLinuxOptions.mimeTypes


plugs?​

readonly optional plugs?: PlugDescriptor | (string | PlugDescriptor)[] | null

Plugs (consumed interfaces) to declare for the app entry point. Defaults to ["desktop", "desktop-legacy", "home", "x11", "wayland", "unity7", "browser-support", "network", "gsettings", "audio-playback", "pulseaudio", "opengl"].

Use "default" in the list to keep the defaults and append extras: ["default", "camera"] adds camera to the standard set.

To configure plug attributes, use a descriptor object:

[
{ "browser-sandbox": { "interface": "browser-support", "allow-sandbox": true } },
"another-simple-plug-name"
]

Note that the Snap Store reserves allow-sandbox (which keeps Chromium's internal sandbox) for vetted publishers and rejects other uploads that request it; electron-builder warns when it is set.


publish?​

optional publish?: Publish

Inherited from​

TargetSpecificOptions.publish


slots?​

readonly optional slots?: SlotDescriptor | (string | SlotDescriptor)[] | null

Slots (provided interfaces) to declare for the app.

To expose an MPRIS player under the Chromium bus name (required for strict confinement):

[{ "mpris": { "name": "chromium" } }]

Chromium hard-codes the bus name chromium, so the slot name must match for snapd to allow it.


stagePackages?​

readonly optional stagePackages?: string[] | null

Ubuntu packages to stage alongside the app (equivalent to depends for deb). Defaults to ["libnspr4", "libnss3", "libxss1", "libappindicator3-1", "libsecret-1-0"].

Use the "default" keyword to extend the default list: ["default", "my-extra-lib"] appends my-extra-lib to the defaults.


summary?​

readonly optional summary?: string | null

A short summary of the snap (max 78 characters). Defaults to productName.


synopsis?​

readonly optional synopsis?: string | null

The short description.

Inherited from​

CommonLinuxOptions.synopsis


title?​

readonly optional title?: string | null

Display title for the snap (may contain uppercase letters and spaces). Defaults to productName. See snap format.


useTemplateApp?​

readonly optional useTemplateApp?: boolean

Whether to use the pre-built Electron snap template for faster builds. When true, electron-builder delegates snap assembly to the upstream Electron snap template rather than running a full snapcraft build, significantly reducing build time. Defaults to true when stagePackages is not customised. Only applicable to x64 and armv7l builds.