Prerequisites
- Node.js (version specified in
.nvmrc) - Rust toolchain (for native modules)
- Platform-specific tools:
- Windows: Visual Studio Build Tools
- macOS: Xcode Command Line Tools
- Linux: Build essentials, depending on your distribution
Build Commands
Development Build
Build all components (main, renderer, and preload) in development mode:- Main process:
npm run build:main:dev - Renderer process:
npm run build:renderer:dev - Preload script:
npm run build:preload:dev
Production Build
Build all components in production mode:Individual Component Builds
Main Process
Renderer Process (Angular)
Preload Script
Native Module Build
Build the Rust native modules:desktop_native/ and built using N-API.
Platform-Specific Builds
Windows
Standard Build
Build for all Windows architectures (x64, ARM64, ia32):npm run build- Build all TypeScript/Angular codenpm run pack:win- Package with electron-builder
Beta Channel
electron-builder.beta.json configuration.
Windows builds create multiple installer formats: NSIS installer, portable executable, and Microsoft Store package.
macOS
Standard Build (Universal Binary)
Build for both Intel and Apple Silicon:With macOS Autofill Extension
- Builds the autofill provider:
./desktop_native/autofill_provider/build.sh - Creates the macOS extension:
npm run build:macos-extension:mac - Packages the app:
electron-builder --mac --universal
Mac App Store (MAS)
Publishing to Mac App Store
xcrun altool:
Linux
Standard Build (x64)
- Snap package (with polkit policy)
- AppImage
- tar.gz archive
- Unpacked directory with resources
ARM64 Build
Flatpak
Development flatpak:The Linux build process includes special handling for:
- Snap packages: Adds polkit policy to
meta/polkit/ - Flatpak: Uses manifest from
resources/com.bitwarden.desktop.devel.yaml - Desktop files and icons for proper integration
Running the App
Development Mode
Production Mode
ELECTRON_IS_DEV=0ELECTRON_NO_UPDATER=1- Runs from
./builddirectory
Publishing
Publish builds to distribution servers:Build Configuration
Webpack Configuration
The app uses webpack with three separate configurations:Environment Variables
NODE_ENV:productionordevelopmentELECTRON_IS_DEV:0or1ELECTRON_NO_UPDATER: Disable auto-updaterBITWARDEN_APPDATA_DIR: Custom app data directoryPORTABLE_EXECUTABLE_DIR: Windows portable mode
macOS Extension Build Variants
The macOS autofill extension can be built for different targets:./desktop_native/autofill_provider/build.sh with the appropriate target parameter.
Cleaning Build Artifacts
./dist directory containing packaged builds.
Post-Install
Afternpm install, the app automatically rebuilds native modules:
Testing Builds
Directory Output (No Packaging)
./dist without creating installers. Useful for testing.
Distribution Build
build + pack:dir).