Lesson 14 of 28
javascriptPackaging & Distribution – electron‑builder
12 mins
Course progress50%
What you'll learn
Keep these ideas in mind as you work through the lesson.
Lesson 14 of 28
javascript12 mins
Keep these ideas in mind as you work through the lesson.
electron‑builder is the most popular tool for creating installers for Windows (nsis), macOS (dmg, pkg) and Linux (AppImage, deb).
npm install --save-dev electron-builder
package.json"build": {
"appId": "com.example.myapp",
"productName": "MyApp",
"directories": { "output": "dist" },
"files": [ "dist/**/*", "main/**/*", "preload/**/*", "package.json" ],
"mac": { "target": "dmg" },
"win": { "target": "nsis" },
"linux": { "target": "AppImage" }
}
"scripts": {
"build": "electron-builder",
"dist": "npm run build"
}
Run npm run build – you’ll get platform‑specific installers in the dist/ folder.
build config:"mac": {
"identity": "Developer ID Application: Your Name (TEAMID)"
}
"win": {
"certificateFile": "cert.pfx",
"certificatePassword": "your‑password"
}