7

我发现使用electron-builder生成的MyApp.exe文件将近500M左右。我不确定我做了什么,因为以前,仅对于 ia32 或 x64,它大约是 196M。我还查看了这个链接,它只提到了大约 55MB-60MB。所以问题是,为什么我的 exe 文件会变得这么大?我的应用程序本身非常小,如果电子只有 33MB 左右,那还有什么额外的空间?

这是我的 package.json 条目:

"build": {
"appId": "com.electron.myApp",
"publish": [
  {
    "provider": "generic",
    "url": "https://myAppServer"
  }
],
"win": {
  "target": [
    {
      "target": "nsis",
      "arch": [
        "ia32"
      ]
    }
  ]
},
"asar": false,
"nsis": {
  "oneClick": true,
  "perMachine": false,
  "artifactName": "${productName}-Setup-${version}.${ext}"

}    
"devDependencies": {
 "electron": "^1.7.9",
 "electron-installer-windows": "^0.2.0",
 "electron-builder": "^19.45.5",
 "electron-packager": "^8.5.2",
 "electron-winstaller": "^2.5.2",
 "grunt-electron-installer": "^2.1.0"
},
"dependencies": {
 "auto-launch": "^5.0.1",
 "cron": "^1.2.1",
 "electron-config": "^0.2.1",
 "electron-positioner": "^3.0.0",
 "electron-squirrel-startup": "^1.0.0",
 "electron-window": "^0.8.1",
 "electron-updater": "^2.16.1",
 "fs": "^0.0.1",
 "homedir": "^0.6.0",
 "https": "^1.0.0",
 "https-proxy-agent": "^1.0.0",
 "line-by-line": "^0.1.5",
 "pac-proxy-agent": "^1.0.0",
 "url": "^0.11.0",
 "winreg": "^1.2.3",
 "xml2js": "^0.4.17"
} 
}

这是电子应用程序的预期大小吗?有什么办法可以让这个变小?

问候, 阿伦

4

1 回答 1

10

您可以尝试npm prune --production,但即使是最小的 Electron 应用程序也将在 100MB 左右。

于 2017-12-18T10:34:01.353 回答