Electron builder with webpack
TL, dr:
This is what I got:
-
Electron
-
To react
-
Webpack
-
electron builder
-
electron arc
-
node-layers
-
some static assets (.png, .svg, etc.)
Here I want:
- Cross-platform autorun installer for software
Long version and problems:
I can get Electron, React, Electron Edge, node-fibers, webpack and static assets to work fine when I run webpackserver in dev mode.
However, how can I integrate this into an electron builder?
I'm new to this build process and I just took this template to get started: Github template
It seems to me that the dev debugging process looks like this:
-
Ask webpack to create bundle.js and index.html from src folder
-
Run webpackserver with hot mode that serves these files.
However, how should I tell the e-builder where to get the different files from? There are no package.json packages and no node_modules / inside dist / and node-fibers is also not bundled (because webpack seems to work with __dirname or smth so I excluded it).
Whenever I run the generated .exe file (not the installer, just the exe file that should run the program), I get a message stating that main.js could not be found in the app.asar file. I tried to extract it but it fails before it delivers the whole package. Anyway, Main.js is never needed because this is because webpack has outperformed it or am I missing something here?
I've searched all over the internet for hours, but I don't have all the concepts.
Can anyone please explain what is wrong with my setup and what can I do to fix it?
source to share
I recommend you use https://github.com/chentsulin/electron-react-boilerplate
If you don't want to use a responsive template for your application, consider using https://github.com/electron-userland/electron-webpack (but using a template template is recommended).
source to share
I ended up with this pattern:
https://github.com/szwacz/electron-boilerplate
I couldn't get HMR to work and had to fix some es6 things, but at least it did the job.
source to share