electron / forge

:electron: A complete tool for building and publishing Electron applications
https://electronforge.io
MIT License
6.34k stars 494 forks source link

webpack-plugin: allow renderer to be handled by webserver and bundled build output of other frameworks (cra, angular, ...) #3182

Open Taschenbuch opened 1 year ago

Taschenbuch commented 1 year ago

Pre-flight checklist

Problem description

short: popular frameworks like create-react-app (CRA) or angular already use webpack and typescript (typescript is optionally for CRA). They will setup for you a development server during development or bundle the code for the production. Especially the webserver gives invaluable framework specific feedback during the development phase. But currently the webpack-plugin wants to bundle the renderer production output and the renderer development webserver. though other frameworks already do that and give better framework related output to the user.

long: I will give you 2 examples for how popular frameworks like angular and create-react-app handle development phase and production output and then explain what would be nice for forge or the webpack-plugin:

ANGULAR:

CREATE-REACT-APP Create-react-app is using webpack and optionally typescript. The screenshot below shows a react project created by the commandnpx create-react-app my-app which is probably the most popular framework for people to start with react. It is very similar to angular: one command to create a build output react-scripts build for production. One command for developping to start a development webserver which automatically updates when code is changed and reports errors: react-scripts start. The difference to angular is: the webserver has a different port. The build output folder has a different name and a different folder/files structure. The console output is different too because it is specialized for react and has some additional automatically applied eslint when changing code. image

Proposed solution

ELECTRON-FORGE WEBPACK-PLUGIN feature request:

I only know create-react-app and angular, so maybe I am missing something which other people could add to improve this idea for other popular web frameworks that bundle their code already. NEXTJS and VUE come to my mind.

example config (those attributes are maybe at the wrong place and not that clear and maybe we need more of them. but just to give a rough example) image

Alternatives considered

...

Additional information

No response

Blaekbit commented 2 weeks ago

Are there any updates or working examples on this usecase? We are trying to accomplish just that - an electron-forge app with a NextJS app inside of it. We would like to leverage the development server, build process, etc. from NextJS and hook that into the Electron Forge Webpack+Typescript "boilerplate".