在package.json里面加入以下代码

  "scripts": {
    "build": "node .electron-vue/build.js && electron-builder --platform=win32  --arch=ia32",
    "win32": "node .electron-vue/build.js && electron-builder --platform=win32  --arch=ia32",
    "mac": "node .electron-vue/build.js && electron-builder --platform=drwin ",
    "build:dir": "node .electron-vue/build.js && electron-builder --dir",
    "build:clean": "cross-env BUILD_TARGET=clean node .electron-vue/build.js",
    "build:web": "cross-env BUILD_TARGET=web node .electron-vue/build.js",
    "dev": "node .electron-vue/dev-runner.js",
    "e2e": "npm run pack && mocha test/e2e",
    "lint": "eslint --ext .js,.vue -f ./node_modules/eslint-friendly-formatter src test",
    "lint:fix": "eslint --ext .js,.vue -f ./node_modules/eslint-friendly-formatter --fix src test",
    "pack": "npm run pack:main && npm run pack:renderer",
    "pack:main": "cross-env NODE_ENV=production webpack --progress --colors --config .electron-vue/webpack.main.config.js",
    "pack:renderer": "cross-env NODE_ENV=production webpack --progress --colors --config .electron-vue/webpack.renderer.config.js",
    "test": "npm run unit && npm run e2e",
    "unit": "karma start test/unit/karma.conf.js",
    "postinstall": "npm run lint:fix"
  },

打包windows执行

npm run win32

打包mac执行

npm run mac

只需要添加上面scripts里面的mac和win32就可以 想要打包其他的同理

 

 

Logo

前往低代码交流专区

更多推荐