forge
forge copied to clipboard
No renderer process in the @electron-forge/plugin-webpack throws error
Pre-flight checklist
- [X] I have read the contribution documentation for this project.
- [X] I agree to follow the code of conduct that this project uses.
- [X] 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
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
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.
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?
@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.
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')
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.