【问题标题】:Electron Builder excluding nested node_modulesElectron Builder 不包括嵌套的 node_modules
【发布时间】:2021-01-08 05:20:52
【问题描述】:

我正在使用 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?我的电子版是8.2.0

【问题讨论】:

    标签: node.js macos electron node-modules electron-builder


    【解决方案1】:

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

    如果您仍想将其包含在您的包中,请将其添加到您的电子构建器配置中: "files": ["node_modules/**/*"]

    【讨论】:

      猜你喜欢
      • 2018-09-12
      • 1970-01-01
      • 2019-01-20
      • 2016-03-14
      • 2019-04-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-03-07
      相关资源
      最近更新 更多