这是我第一次构建electronjs
应用程序,所以很可能我不知道自己在做什么。
我按照github
和this的说明操作。
这是我的package.json
:
{
"name": "ExampleApp",
"productName": "ExampleApp",
"version": "1.0.0",
"description": "Fun app.",
"license": "MIT",
"repository": "user/repo",
"author": {
"name": "sooon",
"email": "Example@gmail.com",
"url": "Example.com"
},
"build": {
"appId": "com. Example.ExampleApp",
"mac": {
"target": "dmg",
"icon": "build/icon.png"
},
"win": {
"target": "nsis",
"icon": "build/icon.png"
}
},
"scripts": {
"test": "xo",
"start": "electron .",
"pack": "electron-builder --dir",
"dist": "electron-builder"
},
"dependencies": {
"electron-debug": "^1.0.0",
"jquery": "^3.3.1"
},
"devDependencies": {
"devtron": "^1.1.0",
"electron": "^1.8.2",
"electron-builder": "^19.56.0",
"electron-packager": "^8.7.2",
"xo": "^0.18.0"
},
"xo": {
"envs": [
"node",
"browser"
]
}
}
正如您所看到的,mac
脚本中有win
和build
。但是当我跑步时:
nom run dist
仅构建DMG
个文件(功能齐全)。使用win
应用程序无法进行任何工作。我错过了什么?
我正在使用10.12.6
上运行的MacBook构建此功能。是否只有你可以为自己的平台构建?可以为Mac
构建Windows
吗?
Update01 我拿出来了:
"build": {
"appId": "com.sooonism.pipidance",
"mac": {
"target": "dmg",
"icon": "build/icon.png"
},
"win": {
"target": "nsis",
"icon": "build/icon.png"
}
},
来自package.json
的,它仍然可以构建。这意味着build
脚本可能位于某个地方?
答案 0 :(得分:5)
electron-builder默认为当前平台构建。要同时构建两者,您需要在“脚本”中执行以下操作,以构建Mac和窗口:
“ dist-all”:“ electron-builder -mw”