其他分享
首页 > 其他分享> > electron打包分发

electron打包分发

作者:互联网

  1. 原始的方式打包
  1. 应用程序打包成一个文件
npm install -g asar
asar pack your-app app.asar
electron/resources/
└── app.asar

1和2如果要想生成对应的安装包可以借用第三方安装包生成工具进行生成如Inno Setup

  1. 借助第三方打包工具
yarn add electron-builder --dev
npm electron-builder --dev
"scripts": {
    "test": "node main.js",
    "dist": "electron-builder --win --x64"
  },
  "asar": {
    "unpackDir": "node_modules/edge-cs/**"
  },
  "build": {
    "appId": "electronpicture",
    "mac": {
      "target": [
        "dmg",
        "zip"
      ]
    },
    "win": {
      "target": [
        "nsis",
        "zip"
      ],
      "icon": "icon/006.ico"
    }
  },
npm run dist

标签:node,分发,asar,builder,electron,app,打包
来源: https://www.cnblogs.com/ants_double/p/10489045.html