电子生成器应用程序大小太大 [英] electron builder app size is too large

查看:19
本文介绍了电子生成器应用程序大小太大的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I find that the MyApp.exe file generated using electron-builder is nearly about 500M. I am not sure what I did because previously, just for ia32 or x64, it would be around 196M. I also looked at this link and it mentions only about 55MB-60MB. So the question is, why am I getting such large sizes for my exe files? My app itself is very small and if electron is only around 33MB, what's all that extra space there?

这是我的 package.json 条目:

Here are my package.json entries:

"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"
} 
}

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

Is this the expected size of an electron app? Any way to make this smaller?

问候,阿伦

推荐答案

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

You can try npm prune --production but even the most minimal Electron application is going to be around 100MB.

这篇关于电子生成器应用程序大小太大的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆