原创文章,转载请注明出处
附官方文档链接:http://www.electronjs.org/docs/tutorial/boilerplates-and-clis#electron-builder
- 安装依赖
npm install --save-dev electron-builder
- 在
package.json
文件中scripts添加"build": "electron-builder -w --ia32"
- 执行
npm run build
,会生成一个dist文件夹,里面会有.exe文件 - 你瞧,就是这么简单,就是这么easy,当初弄了好几天,emmm...
- 附
package.json
代码
{
"name": "ele-platform",
"version": "1.0.0",
"description": "",
"main": "main.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "electron .",
"build": "electron-builder -w --ia32"
},
"author": "",
"license": "ISC",
"devDependencies": {
"electron": "^9.0.5",
"electron-builder": "^22.7.0"
}
}