Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No renderer process in the @electron-forge/plugin-webpack throws error #2859

Closed
3 tasks done
qiqetes opened this issue Jun 3, 2022 · 7 comments · Fixed by #2950
Closed
3 tasks done

No renderer process in the @electron-forge/plugin-webpack throws error #2859

qiqetes opened this issue Jun 3, 2022 · 7 comments · Fixed by #2950
Assignees
Labels
bug plugin/webpack Issues or pull requests related to first-party webpack plugins/templates

Comments

@qiqetes
Copy link

qiqetes commented Jun 3, 2022

Pre-flight checklist

  • I have read the contribution documentation for this project.
  • I agree to follow the code of conduct that this project uses.
  • I have searched the issue tracker for a bug that matches the one I want to file, without success.

Electron Forge version

6.0.0-beta.63

Electron version

18.0.2

Operating system

macOs 12.0.3

Last known working Electron Forge version

No response

Expected behavior

I want to use electron without the renderer process, after tweaking the plugin-webpack config the only thing worked was:

"plugins": [
        [
          "@electron-forge/plugin-webpack",
          {
            "mainConfig": "./webpack.main.config.js",
            "renderer": {
              "config": {},
              "entryPoints": []
            }
          }
        ]

Then I wanted to add the preload.ts script, and couldn't get rid of any of the entryPoints:

"plugins": [
        [
          "@electron-forge/plugin-webpack",
          {
            "mainConfig": "./webpack.main.config.js",
            "renderer": {
              "config": "./webpack.main.config.js",
              "entryPoints": [{"name": "main_window",
                  "preload": {
                    "js": "./src/preload.ts"
                  },
                  "html": "./src/index.html",
                  "js": "./src/renderer.ts"}]
            }
          }
        ]

Using electron without a renderer process should be a use case that should be contemplated.

Actual behavior

Any change did (remove the line with the index.html or remove the "js"), this error arise on npm run start:

An unhandled error has occurred inside Forge:
Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
 - configuration.entry['main_window'][0] should be a non-empty string.

Steps to reproduce

Start the ts-webpack template and try to get rid of the boilerplate renderer bits, and adding the config for preload.

      "renderer": {
              "config": "./webpack.renderer.config.js",
              "entryPoints": [
                {
                  "name": "main_window",
                  "preload": {
                    "js": "./src/preload.ts"
                  }
                }
              ]
            }

fails

                  "renderer": {
              "config": "./webpack.renderer.config.js",
              "entryPoints": [
                {
                  "name": "main_window",
                  "preload": {
                    "js": "./src/preload.ts"
                  },
                  "html": "./src/index.html"
                }
              ]
            }

fails

                  "renderer": {
              "config": "./webpack.renderer.config.js",
              "entryPoints": [
                {
                  "name": "main_window",
                  "preload": {
                    "js": "./src/preload.ts"
                  },
                  "js": "./src/renderer.ts"
                }
              ]
            }

also fails

Additional information

No response

@qiqetes qiqetes added the bug label Jun 3, 2022
@erickzhao erickzhao added the plugin/webpack Issues or pull requests related to first-party webpack plugins/templates label Jun 3, 2022
@erickzhao erickzhao self-assigned this Jun 3, 2022
@VerteDinde VerteDinde self-assigned this Jul 5, 2022
@oeed
Copy link

oeed commented Aug 17, 2022

Any update on this? Have the same issue. Only 'solution' is to have stub files.

@handyzhang
Copy link

The same problem, in my project, both the html and js of the renderer are generated by umi, so
I just need webpack for main.js and preload.js
but
TypeError: Cannot read property 'entryPoints' of undefined
Renderer is a required field

@qiqetes
Copy link
Author

qiqetes commented Oct 5, 2022

Any update on this? Have the same issue. Only 'solution' is to have stub files.

The same problem, in my project, both the html and js of the renderer are generated by umi, so I just need webpack for main.js and preload.js but TypeError: Cannot read property 'entryPoints' of undefined Renderer is a required field

Just keep them and don't do anything with them, you can leave them empty as long as you don't delete the file.

@greenbeam-ita
Copy link

Electron documentation strongly suggest electron-forge to package and distribute the application, but electron forge has very poor documentation. I'm making a huge effort understanding how to configure properly electron-forge for an application simply render an online page.

Any updates?

@erickzhao
Copy link
Member

erickzhao commented Mar 3, 2023

@greenbeam-ita are you stuck on anything in particular? I'm not sure what you're referring to in relation to this issue. There's a linked PR that landed with associated documentation.

@greenbeam-ita
Copy link

I've got an electron application that works with an online application, I simply append a preload, I don't need renderer in my webpack configuration. There's no way to start webpack plugin without renderer configuration.

I also have another issue related with arch and native node dependencies, maybe you have another topic to suggest:
I've got this error (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')

@erickzhao
Copy link
Member

There's no way to start webpack plugin without renderer configuration.

Hmm, we could definitely improve the documentation around that. I think I forgot to expand the docs! But see #2950 for a preload-only renderer entry point. Your remotely-loaded URL will still be running in a renderer process, so you can't avoid having any renderer config if you're loading a BrowserWindow.

I also have another issue related with arch and native node dependencies, maybe you have another topic to suggest:
I've got this error (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')

I'm not 100% sure about this but it sounds like your native dependency doesn't have an arm64 version and you're running on an Apple Silicon Mac.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug plugin/webpack Issues or pull requests related to first-party webpack plugins/templates
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants