1、特点:
1、electron-builder 可以打包成msi、exe、dmg文件,macOS系统,只能打包dmg文件,window系统才能打包exe,msi文件;
2、几乎支持了所有平台的所有格式;
3、支持Auto Update;
4、支持CLI和JS API两种使用方式;
2、windows 和 linux 打包
{
"name": "web",
"version": "1.8.0",
"private": true,
"homepage": "./",
"main": "main.js",
"scripts": {
"serve": "vue-cli-service serve --open",
"start": "yarn serve",
"build": "vue-cli-service build",
"electron-start": "electron .",
"package": "electron-builder --publish never --win",
"package:linux": "electron-builder --publish never --linux",
"dev": "concurrently \"wait-on http://localhost:8080 && electron .\" \"cross-env BROWSER=none yarn start\""
},
"dependencies": {},
"devDependencies": {
"electron": "^8.2.1",
"electron-builder": "21.2.0"
},
"build": {
"appId": "Electron-desktop",
"productName": "Electron-desktop",
"copyright": "",
"directories": {
"output": "build"
},
"win": {
"target": [
"nsis"
],
"icon": "./dist/image/GuangFu.ico"
},
"linux": {
"target": [
"AppImage"
]
},
"extends": null,
"asar": true,
"nsis": {
"oneClick": false,
"allowToChangeInstallationDirectory": true,
"installerHeaderIcon": "./dist/image/HDLogo.ico",
"installerIcon": "./dist/image/HuoDian.ico",
"createDesktopShortcut": true
}
}
}
3、electron-vue build遇到的问题
3-1、electron-builder 下载 electron过慢的解决办法
https://blog.csdn.net/u010537398/article/details/106883059
3-2、app-builder-v0.6.1-x64.7z 安装包问题
https://blog.csdn.net/az44yao/article/details/85242442
https://segmentfault.com/a/1190000013473230
4、electron-updater实现自动更新