简体   繁体   中英

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). 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.

My 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? My electron version is 8.2.0

Electron-builder will pack the node_modules by removing the dev node dependencies and unused 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/**/*"]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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