1、安装electron-builder
npm install electron-builder --save-dev
2、在项目的package.json文件中配置 electron-builder相关参数
- 具体参数可以参考官方文档:https://www.electron.build/configuration/configuration
- 下面贴出我自己的配置:
{
"name": "electron-quick-start",
"version": "1.0.0",
"description": "A minimal Electron application",
"main": "main.js",
"scripts": {
"start": "electron .",
"build": "electron-builder"
},
"build": {
"appId": "com.imaxue.app",
"productName":"yangyi",
"win": {
"icon": "build/favicon.ico",
"target": [
"nsis"
]
},
"nsis": {
"oneClick": false,
"perMachine": true,
"allowToChangeInstallationDirectory": true
}
},
"repository": "https://github.com/electron/electron-quick-start",
"keywords": [
"Electron",
"quick",
"start",
"tutorial",
"demo"
],
"author": "GitHub",
"license": "CC0-1.0",
"devDependencies": {
"electron": "^8.2.5",
"electron-builder": "^22.6.1"
},
"dependencies": {
"bootstrap": "^4.5.0",
"electron-store": "^5.1.1",
"uuid": "^8.1.0"
}
}
- 注意要是下载源有问题的话可以在build中添加
"electronDownload":{
"mirror":"https://npm.taobao.org/mirrors/electron/"
},
3、执行打包命令
npm run build
4、完成
完成以后会在项目目录下生成dist目录
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。