电子建设者 - 只为mac构建,但设置为构建mac并获胜

时间:2018-02-09 09:49:57

标签: javascript macos npm electron-builder

这是我第一次构建electronjs应用程序,所以很可能我不知道自己在做什么。

我按照githubthis的说明操作。 这是我的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脚本中有winbuild。但是当我跑步时:

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脚本可能位于某个地方?

1 个答案:

答案 0 :(得分:5)

electron-builder默认为当前平台构建。要同时构建两者,您需要在“脚本”中执行以下操作,以构建Mac和窗口:

“ dist-all”:“ electron-builder -mw”