打包
使用 electron-builder 打包应用
(1)安装 electron-builder
bash
npm install electron-builder -D
1
(2)在 package.json
中进行相关配置
json
{
"name": "learn_electron",
"version": "1.0.0",
"description": "this is a electron demo",
"main": "main.js",
"scripts": {
"start": "electron .",
"build": "electron-builder"
},
"build": {
"appId": "com.dancy.learn_electron",
"win": {
"icon": "./logo.ico",
"target": [
{
"target": "nsis",
"arch": [
"x64"
]
}
]
},
"nsis": {
"oneClick": false,
"perMachine": true,
"allowToChangeInstallationDirectory": true
}
},
"keywords": [],
"author": "dancy",
"license": "ISC",
"devDependencies": {
"electron": "^33.2.0",
"electron-builder": "^25.1.8"
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
(3)执行打包命令
bash
npm run build
1