Electron forge webpack remove renderer config

544 Views Asked by At

I use Electron Forge with the webpack template. For the renderer i use an url (mainWindow.loadURL(startURL);) and want to remove everything in the webpack config that has to do with the renderer. Is there a way to use the webpack template without the webpack creating the "renderer" part

package.json

"config": {
    "forge": {
      "packagerConfig": {},
      "makers": [
        {
          "name": "@electron-forge/maker-squirrel",
          "config": {
            "name": "webpack_test"
          }
        },
        {
          "name": "@electron-forge/maker-zip",
          "platforms": [
            "darwin"
          ]
        },
        {
          "name": "@electron-forge/maker-deb",
          "config": {}
        },
        {
          "name": "@electron-forge/maker-rpm",
          "config": {}
        }
      ],
      "plugins": [
        [
          "@electron-forge/plugin-webpack",
          {
            "mainConfig": "./webpack.main.config.js",
            "renderer": {                                        <<<< I want to remove this part
              "config": "./webpack.renderer.config.js",
              "entryPoints": [
                {
                  "html": "./src/index.html",
                  "js": "./src/renderer.js",
                  "name": "main_window"
                }
              ]
            }
          }
        ]
      ]
    }
  },

If I simply remove the part I get the message that no entryPoint is defined.

An unhandled error has occurred inside Forge:
Cannot read property 'entryPoints' of undefined
TypeError: Cannot read property 'entryPoints' of undefined
    at WebpackConfigGenerator.getDefines (F:\__electron\tools\electron\node_modules\@electron-forge\plugin-webpack\src\WebpackConfig.ts:103:35)
    at WebpackConfigGenerator.getMainConfig (F:\__electron\tools\electron\node_modules\@electron-forge\plugin-webpack\src\WebpackConfig.ts:153:3
9)
    at asyncFn (F:\__electron\tools\electron\node_modules\@electron-forge\plugin-webpack\src\WebpackPlugin.ts:234:53)
    at F:\__electron\tools\electron\node_modules\@electron-forge\async-ora\src\ora-handler.ts:35:5
    at new Promise (<anonymous>)
    at asyncOra (F:\__electron\tools\electron\node_modules\@electron-forge\async-ora\src\ora-handler.ts:34:10)
    at WebpackPlugin.compileMain (F:\__electron\tools\electron\node_modules\@electron-forge\plugin-webpack\src\WebpackPlugin.ts:233:11)
    at WebpackPlugin.startLogic (F:\__electron\tools\electron\node_modules\@electron-forge\plugin-webpack\src\WebpackPlugin.ts:348:16)
    at forgeSpawn (F:\__electron\tools\electron\node_modules\@electron-forge\core\src\api\start.ts:60:32)
    at forgeSpawnWrapper (F:\__electron\tools\electron\node_modules\@electron-forge\core\src\api\start.ts:121:21)
    at F:\__electron\tools\electron\node_modules\@electron-forge\cli\src\electron-forge-start.ts:59:19
0

There are 0 best solutions below