nklayman / vue-cli-plugin-electron-builder

Easily Build Your Vue.js App For Desktop With Electron
https://nklayman.github.io/vue-cli-plugin-electron-builder/
MIT License
4.12k stars 278 forks source link

Builder couldn't find the background.js file in resources/app.asar #1977

Closed tbhaxor closed 1 year ago

tbhaxor commented 1 year ago

Describe the bug

Error I am getting

Error: Application entry file "background.js" in the "/mnt/Projects/electron/dist_electron/linux-unpacked/resources/app.asar" does not exist. Seems like a wrong configuration.

To Reproduce

  1. Install starter vue app with "vue-cli-plugin-electron-builder": "3.0.0-alpha.4", version
  2. Configure the script with following config
const { defineConfig } = require("@vue/cli-service");
const { EnvironmentPlugin } = require("webpack");

module.exports = defineConfig({
  pluginOptions: {
    electronBuilder: {
      extends: null,
      nodeIntegration: false,
      preload: {
        common: "electron/preloads/common.js",
      },
      mainProcessFile: "electron/background.js",
      builderOptions: {
        appId: "com.app.app",
        productName: "App",
        artifactName: "${productName}-v${version}.${ext}",
        win: {
          target: ["nsis"],
        },
        linux: {
          target: ["AppImage"],
          category: "Utility",
        },
        mac: {
          target: ["dmg", "zip"],
          icon: "electron/build-rsrc/icon.png",
          hardenedRuntime: true,
          gatekeeperAssess: false
        },
        afterSign: 'scripts/notorize.js',
        dmg: {
          title: "Install ${productName} v${version}",
        },
      },
    },
  },
  chainWebpack: (config) => {
    config.plugin("process.env").use(EnvironmentPlugin);
    config.output.hashFunction("sha256");
  },
  transpileDependencies: true,
  lintOnSave: false,
});

Expected behavior

It should build app

Screenshots If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

Additional context Add any other context about the problem here.

tbhaxor commented 1 year ago

Fixed by removing main key in package.json