简体   繁体   English

Electron Builder 不包括嵌套的 node_modules

[英]Electron Builder excluding nested node_modules

I am using electron-builder 22.6.0 to create mas build but .app file does not include nested node_modules (node_modules of myApp).我正在使用电子构建器 22.6.0 来创建 mas 构建,但 .app 文件不包含嵌套的 node_modules(myApp 的 node_modules)。 I have tried using extraFiles in package.json it creates a folder in Resources and copy all the node_modules in that but still getting 404.我尝试在 package.json 中使用 extraFiles 它在资源中创建一个文件夹并复制其中的所有 node_modules 但仍然得到 404。

My package.json:我的 package.json:

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

Folder structure:文件夹结构:

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

How can I include node_modules by default?默认情况下如何包含 node_modules? My electron version is 8.2.0我的电子版是8.2.0

Electron-builder will pack the node_modules by removing the dev node dependencies and unused modules. Electron-builder 将通过删除开发节点依赖项和未使用的模块来打包node_modules We don't need to do this manually.我们不需要手动执行此操作。

If you still want to include this in your package, add this to your electron-builder configuration: "files": ["node_modules/**/*"]如果您仍想将其包含在您的包中,请将其添加到您的电子构建器配置中: "files": ["node_modules/**/*"]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM