不包括嵌套的 Electron Builder node_modules

Electron Builder excluding nested node_modules

我正在使用 electron-builder 22.6.0 创建 mas 构建,但 .app 文件不包含嵌套的 node_modules(myApp 的 node_modules)。我试过在 package.json 中使用 extraFiles 它在 Resources 中创建一个文件夹并复制其中的所有 node_modules 但仍然得到 404.

我的package.json:

"extraResources": [
  {
    "from": "path/node_modules",
    "to": "path/node_modules",
    "filter": [
      "**/*"
    ]
  }
],

文件夹结构:

---root
    --package.json
    --node_modules
    --myApp
       --package.json
       --node_modules

如何默认包含 node_modules?我的electron版本是8.2.0

Electron-builder 将通过删除开发节点依赖项和未使用的模块来打包 node_modules。我们不需要手动执行此操作。

如果您仍想将其包含在您的包中,请将其添加到您的 electron-builder 配置中: "files": ["node_modules/**/*"]