Use the electron builder to package the application.

The installation

yarn add electron-builder --dev
Copy the code

Modify thepackage.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"}}}Copy the code

run

yarn bd
Copy the code

The corresponding package files are generated in the build/dist directory

Blog Address:
alibt.top

More exciting, please pay attention to my public number!