electron-builder - 只为 mac 构建,但设置为构建 mac 并获胜

electron-builder - only build for mac but set to build mac and win

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

我按照 github and 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"
    ]
  }
}

如您所见,我在 build 脚本中有 macwin。但是当我 运行:

nom run dist

只有 DMG 个文件(功能齐全)正在构建。 win 应用程序没有任何工作痕迹。我在设置中错过了什么?

我正在 10.12.6 上用我的 MacBook 运行ning 构建这个。是否只有您可以为自己的平台构建? 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 脚本可能位于某处?

electron-builder 默认为当前平台构建。要构建两者,您需要在 "script" 中执行类似的操作,以构建 mac 和 window:

"dist-all": "electron-builder -mw"