(十三) electron 應用打包

一念輪迴發表於2018-08-08

使用 electron-builder來打包應用。

安裝

yarn add electron-builder --dev
複製程式碼

修改package.json

{
    "scripts": {
        "dev": "node build/dev-runner",
        "start": "electron electron/main",
        "serve": "vue-cli-service serve",
        "build": "vue-cli-service build",
        "lint": "vue-cli-service lint",
        "pack": "electron-builder --dir",
        "dist": "electron-builder",
        "bd": "yarn build && electron-builder",
        "postinstall": "electron-builder install-app-deps"
    },
    "build": {
        "productName": "EBlog",
        "directories": {
            "output": "build/dist"
        },
        "files": [
            "dist/**/*",
            "electron/**/*"
        ],
        "extraResources": "public",
        "dmg": {
            "contents": [
                {
                    "x": 410,
                    "y": 150,
                    "type": "link",
                    "path": "/Applications"
                },
                {
                    "x": 130,
                    "y": 150,
                    "type": "file"
                }
            ]
        },
        "mac": {
            "icon": "build/icons/icon.icns"
        }
    }
}

複製程式碼

執行

yarn bd
複製程式碼

會在build/dist目錄下生成對應包檔案

(十三) electron 應用打包
部落格地址: alibt.top

更多精彩,請關注我的公眾號!

相關文章