【问题标题】:electron builder, mac dmg package including files for build stageelectron builder, mac dmg 包,包括构建阶段的文件
【发布时间】:2019-01-20 05:37:26
【问题描述】:

我正在使用 electron-builder 为 windows、mac 和 linux 打包我的应用程序。

生成的包大小相同,但对于 Mac,文件大小是原来的两倍。

有一个巨大的 app.asar.unpacked/ 文件夹,其中包含构建阶段不需要的框架。

如何配置 electronbuilder 以跳过这些文件?

myApp.app

这是我的 project.json

{
  "name": "KioskeTV",
  "description": "TV Application",
  "version": "1.0.0",
  "main": "app/src/main.js",
  "scripts": {
    "postinstall": "install-app-deps",
    "start": "npm install && electron .",
    "pack": "build --dir",
    "dist": "build",
    "dist:win": "build --platform win32"
  },
  "repository": "https://github.com/electron/electron-quick-start",
  "keywords": [
    "nobj.io",
    "service",
    "launcher"
  ],
  "author": "Nebular Streams SLU",
  "license": "Proprietary",
  "devDependencies": {
    "electron": "^2.0.0",
    "electron-builder": "^20.26.1"
  },
  "build": {
    "appId": "nobjio",
    "dmg": {
      "contents": [
        {
          "x": 110,
          "y": 150
        },
        {
          "x": 240,
          "y": 150,
          "type": "link",
          "path": "/Applications"
        }
      ]
    },
    "linux": {
      "target": [
        "AppImage",
        "deb"
      ]
    },
    "win": {
      "target": "portable",
      "icon": "build/icon.ico"
    }
  },
  "dependencies": {
    "app-builder-lib": "^20.27.1"
  }
}

【问题讨论】:

    标签: electron electron-builder


    【解决方案1】:

    "ignore 是一个电子打包器选项,必须在构建中指定" 这可能会让你指向正确的方向。祝你好运。 类似这样的构建:

    ignore: function (
    // TODO: add logic here
    console.log(file);
    return false;
    

    另一种可能性: 使用https://github.com/electron-userland/electron-packager/blob/master/docs/api.md#ignore 作为正则表达式。

    【讨论】:

      猜你喜欢
      • 2020-07-11
      • 2021-01-08
      • 2020-08-19
      • 2019-10-21
      • 2018-07-20
      • 2017-11-17
      • 2012-03-23
      • 2016-06-15
      • 2023-03-15
      相关资源
      最近更新 更多